http://acm.hdu.edu.cn/showproblem.php?pid=1001
1 /*written by czk*/ 2 #include <stdio.h> 3 4 int main() { 5 int n; 6 while(scanf("%d", &n) != EOF) 7 if(n%2) 8 printf("%d\n\n", (n+1)/2*n); 9 else 10 printf("%d\n\n", n/2*(n+1)); 11 }