I tried solving 192A, which worked on my pc but when I uploaded on codeforces, the same code gave wrong output. I tried running it on Ideone, where also it produced right result.
codeforces submission
What I'm doing wrong?
# | User | Rating |
---|---|---|
1 | tourist | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 156 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
I tried solving 192A, which worked on my pc but when I uploaded on codeforces, the same code gave wrong output. I tried running it on Ideone, where also it produced right result.
codeforces submission
What I'm doing wrong?
Name |
---|
You are using
long int
which has different meanings on different plataforms, on windows it means a 32 int integer, while on linux it means a 64 bit integer.When you are using a linux based plataform, as Ideone does, and I guess you too, you get the right answer, as if you were using a Windows plataform you would get the wrong answer.
Codeforces runs on a Windows machine and that's why you are getting Wrong Answer here.
My suggestion is that you should never use
long int
and always use eitherlong long
orint
.More information about it here: https://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_models