| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:据说一次过的都要放代码In Reply To:据说一次过的都要放代码 Posted by:NaN3 at 2013-06-22 14:49:44 #include<stdio.h>
int main()
{
int n,i,k,t,ans;
while(scanf("%d",&n),n)
{
k=1;
ans=0;
for(i=0;i<n;)
{
for(t=0;t<k && i<n;t++,i++)
ans+=k;
k++;
}
printf("%d %d\n",n,ans);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator