Solution fails on C++17, but works as expected on C++14

Правка en1, от AshwinBanwari, 2021-09-14 09:21:48

https://mirror.codeforces.com/contest/678/submission/128786847

With C++17, passing the an int into a function(lcm) which accepts a long long for some reason does not cast it to a long long but keeps it as an int. Then, unsurprisingly after being multiplied with another large int, it overflows.

On C++14 which I compiled locally initially, the int was implicitly converted to long long as expected and my solution worked.

Does anyone know why this is happening? I played around with gdb and compiling using C++17 and my gdb just went haywire once I entered the lcm function with the long long parameter.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский AshwinBanwari 2021-09-14 09:21:48 667 Initial revision (published)