Why I am getting different output? Someone please explain the reason behind the WA. Ideoned code: https://ideone.com/ZjNybK CF Submission: https://codeforces.me/contest/1114/submission/49755099
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 164 |
1 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 160 |
5 | -is-this-fft- | 158 |
6 | adamant | 157 |
6 | awoo | 157 |
8 | TheScrasse | 154 |
8 | nor | 154 |
10 | djm03178 | 153 |
Why I am getting different output? Someone please explain the reason behind the WA. Ideoned code: https://ideone.com/ZjNybK CF Submission: https://codeforces.me/contest/1114/submission/49755099
Название |
---|
LONG_MAX is basically 2147483647. So, the answer can be greater than 2147483647. That's it is giving Wrong Answer. Use LLONG_MAX instead.
Thanks but still WA :|
Overflow.
Brother, my soln too got a wa https://codeforces.me/contest/1114/submission/49716174 Can anyone explain why?
https://ideone.com/jfyHLZ This is Your AC solution. The problem was due to over flow when you multiply e = e * x.f Instead if u check if e <= n / x.f it will work finely. I was also unable to find this during the contest.
Yeah it got too late to realise that. Thanks by the way!
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
Where will I set the condition? I am confused :|
Accepted, thanks, btw :)