| ||||||||||
| 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 | |||||||||
麻烦给我看一下,谢谢#include<stdio.h>
void main(){
int i,m,n,a,t,j;
scanf("%d\n",&n);
while(n!=1){
for(i=1;i<=n;i++){
m=n-i;
if(m<=i+1){
j=i;
break;
}
}
for(t=1;t<=j;t++)
a+=t*t;
a=a+m*(j+1);
printf("%d %d\n",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