| ||||||||||
| 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:heheIn Reply To:麻烦给我看一下,谢谢 Posted by:lijiwu at 2004-12-22 14:09:26 #include<stdio.h>
void main(){
int i,n,t;
scanf("%d\n",&n);
while(n!=0){
int a=0;
printf("%d ",n);
for(i=1;i<=n;i++){
n=n-i;
if(n<=i+1)break;
}
for(t=1;t<=i;t++)
a+=t*t;
a=a+n*(i+1);
printf("%d\n",a);
scanf("%d\n",&n);
}
} }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator