| ||||||||||
| 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 | |||||||||
输入不只20组,就runtime error了,读入一组做一组就输出一组,不需要保存起来一起输出In Reply To:这个小程序为什么也会runtime error? Posted by:phantomr at 2005-04-26 10:40:51 > #include<stdio.h>
> int fun(int p,int i,int e,int d)
> {
> int e_,j,day;
> e_=e%33;
> for(j=0;;j++)
> {
> day=e_+33*j;
> if((day-p)%23==0&&(day-i)%28==0)
> break;
> }
> return (day-d);
> }
>
> main()
> {
> int p,e,i,d,j,o[20]={0};
> for(j=1;;j++)
> {
> scanf("%d %d %d %d",&p,&e,&i,&d);
> if(p==-1)
> break;
> o[j]=fun(p,e,i,d);
> }
> for(j=1;o[j]!=0;j++)
> printf("Case %d: the next triple peak occurs in %d days.\n",j,o[j]);
>
> }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator