UVa10079

題目:
https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1020

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll table[210000005] = {};

int main(){
table[0] = 1;
for(int i=1; i<210000001; ++i){
table[i] = table[i-1] + i;
}
int num;
while(cin >> num){
if(num < 0) break;
cout << table[num] << '\n';
}

return 0;
}