[恢]hdu 1001
2011-12-12 03:27:22
地址:http://acm.hdu.edu.cn/showproblem.php?pid=1001
题意:给出多组n,输出1+2+3...n的结果,并跟随一个空白行。
代码:
# include <stdio.h>
int main ()
{
unsigned int n ;
while (~scanf ("%d", &n))
printf ("%d\n\n", n*(n+1)/2) ;
return 0 ;
}
2011-12-12 03:27:22
地址:http://acm.hdu.edu.cn/showproblem.php?pid=1001
题意:给出多组n,输出1+2+3...n的结果,并跟随一个空白行。
代码:
# include <stdio.h>
int main ()
{
unsigned int n ;
while (~scanf ("%d", &n))
printf ("%d\n\n", n*(n+1)/2) ;
return 0 ;
}