№ | Пользователь | Рейтинг |
---|---|---|
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 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 155 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | nor | 152 |
Название |
---|
Auto comment: topic has been updated by Sujay_27 (previous revision, new revision, compare).
Sum can be 1e14 which would lead to overflow you can set a upperlimit of 1e9
The maximum value that a long long variable can have is $$$2^{63} - 1$$$. In your code
sum
can be equal to $$$2 \cdot 10^{14}$$$ in some test cases and thusmid * mid
may get bigger than the long long limit.In worst case, the sum can be 2*10^14 then the mid will be 10^14. mid * mid will be 10^28. long long can hold at most 10^18.
Yeah got it! Thanks mate.
instead of binary search,why arent you using sqrt its much simpler code
yea I figured that, but wanted to try with binary search
it works if you use unsigned long long instead of signed long long (long long)
Oh ok
nah mate, unsigned long long only goes up to about 1.84*10^19, which is still nowhere near 10^28.