I found a very strange problemthing in Educational Codeforces Round 50 F. Relatively Prime Powers.↵
↵
First, here is a AC code written by me. https://mirror.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://mirror.codeforces.com/contest/1036/submission/42680073↵
↵
But This is another AC code written by @alonefight, https://mirror.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://mirror.codeforces.com/contest/1036/submission/42680102↵
↵
FYI, my environment is macbook, clion, c++14.↵
↵
Can anyone tell me why this strange thing happened?↵
↵
↵
↵
First, here is a AC code written by me. https://mirror.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://mirror.codeforces.com/contest/1036/submission/42680073↵
↵
But This is another AC code written by @alonefight, https://mirror.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://mirror.codeforces.com/contest/1036/submission/42680102↵
↵
FYI, my environment is macbook, clion, c++14.↵
↵
Can anyone tell me why this strange thing happened?↵
↵
↵