myor's blog

By myor, history, 3 months ago, In English

Hello, in short, I'm trying to solve 1999E - Тройные операции 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.

  • Vote: I like it
  • +9
  • Vote: I do not like it

»
3 months ago, # |
  Vote: I like it +8 Vote: I do not like it

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.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    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.