.. wrote:What does this statement mean?

- Code: Select all
`Every answer will obey the formula`

fabs(ans*1e3 - floor(ans*1e3) - 0.5) > 1e-2

If "ans" means the value rounded to 3 decimals, then the formula can't be obeyed as "ans" is already rounded, ans*1e3 is an integer......

Here ans means the exact answer. The formula says the following:

Let ans = a_0.a_1a_2a_3a_4... (a_0 is an int, a_i are digits for i>0).

Take ans, multiply by 1000, let this be x.

Take floor(x), subtract it from x.

You are left with the fractional part of x. In our case it is the number 0.a_4a_5a_6...

We are guaranteed that this number differs from 0.5 by a substantial margin, i.e. when three digits after the decimal point are output there should be no rounding errors due to precision.

.. wrote:Anyway, is there any tricky input except the some input value = 0?

I think I have handles these cases correctly, but still WA

Care to explain your algorithm instead? I've got AC, but I'm unaware of any too special cases.