Комментарии
На fonmagnus → How setprecision Works on Division?, 4 года назад
0

For standard streams, the floatfield format flag is set to defaultfloat on initialization. When floatfield is set to defaultfloat, floating-point values are written using the default notation: the representation uses as many meaningful digits as needed up to the stream's decimal precision (precision), counting both the digits before and after the decimal point (if any).

When floatfield is set to fixed, floating-point values are written using fixed-point notation: the value is represented with exactly as many digits in the decimal part as specified by the precision field (precision) and with no exponent part.

References: link1, link2

So, it wasn't setprecision that got your solution accepted, it was fixed. As default precision is set to 6, cout << fixed << (mn+mx)/2.0 << endl; also gets accepted (for this problem).

На Hudayar → Let's grow!, 5 лет назад
0

Interesting! Count me in.

I used to think that stl size() function has complexity of O(n) and always stored the size in a variable before writing a loop.

Practice typing in typeracer.

It would be a help if someone suggests me some way I can improve the readability of my code. TIA

На Nas → Asking for statistics about code forces., 6 лет назад
0

I thought it would be PAG. Maybe he's the second one.

На zeyad_alaa → atcoder knapsack 2, 6 лет назад
0

This helped me.

for(int k=0;k<n;k++) when k = n-1, it's trying to access the data of a[n] inside if(a[k] >= a[k+1]). a[n] will show a garbage value unless you initialize it.