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

Автор ghorardim, история, 9 лет назад, По-английски

I am trying to solve this problem.....

http://mirror.codeforces.com/problemset/problem/281/B

but i am continuously getting WA in a case.i check that case in pc's compiler it gives me correct output.i have copied my code and check it in custom test(codeforce compiler) and it gives different result. i can't found my mistake and can't found the solution :( here is my code http://mirror.codeforces.com/contest/281/submission/17562664

Plz anyone help me...

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

»
9 лет назад, # |
  Проголосовать: нравится +17 Проголосовать: не нравится

Hello, It's not the compiler's fault.

The problem lies with floating point division inaccuracies.

For example, your code will store as 0.16666666666666652 while it'll store as 0.16666666666666674

And yeah, it's not that hard a bug to catch, could have been done with one cerr or cout statement. So may be next time atleast try to debug before posting such misleadingly titled blog