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

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

Hello, in short, I'm trying to solve 1999E - Triple Operations with the following solution: 276991813

While testing locally, the solution correctly returns the expected output for the sample test case, but the judge says the following: "wrong answer 4th numbers differ — expected: '263', found: '262' "

I tried some online compilers and they also return the expected output with my solution. Why is the judge returning a different output?? Any help would be appreciated, thanks.

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

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

it is due to floating point precision. you are using log(a)/log(b) depending on enviroment it can be slightly different, causing your answer to deviate. Try avoid using floating point calculation, or introduce floor/ceil function.

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

    i see. after writing this, i stubbornly submitted to the judge with a different gcc version and managed to get a TLE instead of a WA. will be more careful about precision errors from now, thanks for the help.