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:zzzzzz at 2004-11-22 13:08:42 > #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++) //100 is not big enough ! > { > 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++; > } > } as far as I know: // for(i=1;i<100;i++) //100 is not big enough ! Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator