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 641365704 at 2012-08-15 20:25:01 on Problem 1006
#include<iostream>
using namespace std;
int main()
{
int i,d,e,p,a,n=0;
while(cin>>d>>e>>p>>a)
{
	++n;
	if(d==-1&&e==-1&&p==-1)
		break;
for(i=1;;i++)
	if((i-d)%23==0&&(i-e)%28==0&&(i-p)%33==0&&i>a)
		break;
cout<<"Case "<<n<<": "<<"the next triple peak occurs in "<<i-a<<" 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