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

哪位大侠帮我改改程序,运行超时了

Posted by OUmaster at 2006-07-04 10:41:16 on Problem 1006
#include <stdio.h>

int main(int argc, char *argv[])
{
  int m,j,k,g;
  int p,e,i,d;
  for(g=1;;g++)
  {
   scanf("%d%d%d%d",&p,&e,&i,&d);
   if(p==-1&&e==-1&&i==-1&&d==-1)break;
   for(m=924;m>=1;m--)
    for(j=759;j>=1;j--)
     for(k=644;k>=1;k--)
      if((m*23+p)==(j*28+e)&&(j*28+e)==(k*33+i))
        {printf("case %d: the next triple peak occurs in %d days\n",g,(m*23+p-d));goto elf;}
   elf:{};
  }      
  	
  return 0;
}

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