Hadi & Math
What is the Sum of the numbers from 1 ... n
hint
Knowing the actual sum and the excepted sum, how to find the missing sum?
solution
tip
Michael And The Easy A
hint 1
hint 2
hint 3
# | User | Rating |
---|---|---|
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 |
# | User | Contrib. |
---|---|---|
1 | cry | 166 |
2 | maomao90 | 163 |
2 | Um_nik | 163 |
4 | atcoder_official | 161 |
5 | adamant | 160 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | nor | 153 |
9 | Dominater069 | 153 |
Hadi & Math
What is the Sum of the numbers from 1 ... n
excepted_sum = n*(n+1)/2
Knowing the actual sum and the excepted sum, how to find the missing sum?
answer = n*(n+1)/2 — sum(Array)
For c++ users use long long, and for java users use long to avoid overflow
Michael And The Easy A
What is the maximum sum we can obtain if we have even number of negative integers?
What about odd number of negative integers?
What is the maximum number of negative integers we may have in an optimal sequence?
Name |
---|
Auto comment: topic has been updated by Adam_Jardali (previous revision, new revision, compare).
Auto comment: topic has been updated by Adam_Jardali (previous revision, new revision, compare).
Auto comment: topic has been updated by Adam_Jardali (previous revision, new revision, compare).