Блог пользователя restart_2.0

Автор restart_2.0, история, 5 лет назад, По-английски

Why I am getting different output? Someone please explain the reason behind the WA. Ideoned code: https://ideone.com/ZjNybK CF Submission: https://codeforces.com/contest/1114/submission/49755099

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
5 лет назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

LONG_MAX is basically 2147483647. So, the answer can be greater than 2147483647. That's it is giving Wrong Answer. Use LLONG_MAX instead.

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Brother, my soln too got a wa https://codeforces.com/contest/1114/submission/49716174 Can anyone explain why?

»
5 лет назад, # |
Rev. 2   Проголосовать: нравится +1 Проголосовать: не нравится

Overflow in this line " for(long long i=mp;n/i>=1;i = i*mp) "

For example: i = mp = 100000015333 and n = 1e12, n still larger than i but i * i will be overflowed