AshwinBanwari's blog

By AshwinBanwari, history, 3 years ago, In English

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.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it