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 zidai_78123 at 2008-11-25 18:43:27 on Problem 1006
#include<iostream>
using namespace std;
int main()
{
  const int a=23;
  const int b=28;
  const int c=33;
  int List[10000];
 
  int a1;
  int b1;
  int c1;  
  int d1;
  int i;
  for(i=0;i<10000;i++)
     {cin>>a1>>b1>>c1>>d1;
      if((a1==-1)&&(b1==-1)&&(c1==-1)&&(d1==-1))
	  break;
	  else
	     {a1=a1%a;
		  b1=b1%b;
		  c1=c1%c;
		  for(int k=c1;c1<=21252;c1+=c)
		     {if((c1-b1)%b==0&&(c1-a1)%a==0)
		        {if(c1>d1)
					{List[i]=c1-d1;break;}
			    }
		     }

	      }
	  }

   for(int j=0;j<i;j++)
   {cout<<"Case "<<j+1<<": the next triple peak occurs in "<<List[j]<<" days."<<endl;
   }

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