Two ACs codes output different result

Правка en2, от txingml, 2018-09-08 19:11:50

I found a very strange thing in Educational Codeforces Round 50 F. Relatively Prime Powers.

First, here is a AC code written by me. https://codeforces.com/contest/1036/submission/42680029

And If you add a line "assert(val != 999999999999999956LL);", then this code will fail on test 3. It means test 3 has a case that num = 999999999999999956. https://codeforces.com/contest/1036/submission/42680073

But This is another AC code written by @alonefight, https://codeforces.com/contest/1036/submission/42657108. I ran it in my local environment and compared with my code. The result is surprised.

I used the test case as follow. 1 999999999999999956

My result is 999999998998996625 But @alonefight's result is 999999998998996624

I submitted his code and it still passed all test case. https://codeforces.com/contest/1036/submission/42680102

FYI, my environment is macbook, clion, c++14.

Can anyone tell me why this strange thing happened?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский txingml 2018-09-08 19:11:50 12 Tiny change: 'y strange problem in Educat' -> 'y strange thing in Educat'
en1 Английский txingml 2018-09-08 19:11:26 1012 Initial revision (published)