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

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

I have submitted this code to this problem https://codeforces.com/contest/514/problem/B but got wrong answer, i went to the tutorial and found the same method, so i saw some accepted codes and i had the exact code, but i still don't know why I'm getting wrong answer this is my code: https://codeforces.com/contest/514/submission/62895602 and this is an accepted code: https://codeforces.com/contest/514/submission/17915278 would be nice to know why.

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

»
5 лет назад, # |
Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

For some reason putting "set double st;" inside the main solved the problem, i just dont know why that even made a problem in the first place, no idea XD

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

Seems like precision problems. I changed your code a bit and instead of using double I used long double and it got AC.

Link for submission: 62939486

From this article it turns out that long double has greater precision than double but it depends on compiler.