Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

Блог пользователя rkb_rd

Автор rkb_rd, 13 месяцев назад, По-английски

During solving this problem, when i submitted the following code with c++ setprecision function i got Wrong answer on test 5.

Code

And later the following one got accepted without setprecision.

Code

My question is, what i did wrong in the first one?

Thank You...

Upd: Got the error. Should use long double instead double

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

»
13 месяцев назад, # |
Rev. 2   Проголосовать: нравится -6 Проголосовать: не нравится

.

»
13 месяцев назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

I can't see the actual wrong answer message so this is just guesses. It could be that when you're dividing by 2 in the first solution, ans is so large that floating point precision is too much of a problem (i.e. rounds it closer to .4 or .6 instead of .5)