Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

这个小程序为什么也会runtime error?

Posted by phantomr at 2005-04-26 10:40:51 on Problem 1006
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator