restart_2.0's blog

By restart_2.0, history, 5 years ago, In English

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

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

»
5 years ago, # |
  Vote: I like it +1 Vote: I do not like it

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 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

»
5 years ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

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