Can anybody explain why there is a variation in answer if I change the c++ version ?
problem link : 1228C - Primes and Multiplication
My submission got wrong verdict in testcase 14 using GNU C++17 (64) 116231648
My submission got AC using GNU C++17 116231294
The issue is with the
pow
function, the value returned by it can overflow double.long double
before passing (AC code), orpowl()
See this for more details.
I am not sure, why it worked for the 32-bit version32 bit g++ by default does all of its floating-point arithmetic with (80 bit) long double. See this for more info.
Also, I think it's better to use your own power function instead of pow as I have heard it might cause some precision issues
It's not always the case. This should help.
Oh, thanks
Thanks :)