[求助]C语言《acm 题 》进来坐坐吧
浙江 acm 的2345地址:http://acm.zju.edu.cn/show_problem.php?pid=2345有谁帮帮我!!!!!!!!!在下非常感谢!!!!
看看我AC的.
#include<stdio.h>
int main()
{
long sum;
int n,i,j,k,num;
scanf("%d",&num);
while(num--)
{
while(EOF!=(scanf("%d",&n))&&n!=0)
{
sum=0;
k=1;
for(i=0;i<n;)
{
j=1;
while(i<n&&j<=k)
{
sum+=k;
j++;
i++;
}
k++;
}
printf("%d %ld\n",n,sum);
}
if(num!=0)
{
printf("\n");
}
}
return 0;
}