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 day[21],i,j,sum,m,k=0; for(j=0;j<21;j++) { scanf("%d",&day[j]); if(day[j]==0)break; } while(day[k]!=0) { sum=0; for(i=1;i<100;i++) { sum+=i; if(sum>=day[k])break; } m=0; for(j=1;j<=i;j++) m+=j*j; m=m-(sum-day[k])*i; printf("%d %d\n",day[k],m); k++; } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator