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

where is my mistake?

Posted by Gott331 at 2006-04-12 16:50:11 on Problem 1006
#include <iostream>

using namespace std;

const int ptime=23,etime=28,itime=33;
int p,e,i,d;
int result,k,num=0;	

int main(){	
	cin>>p>>e>>i>>d;
	while(p!=-1&&e!=-1&&i!=-1&&d!=-1){
		++num;
		for(int ii=1;ii<=etime*itime;++ii){

			result=(p+ptime*ii-e)%etime;

			if(result==0){				
				result=(p+ptime*ii-i)%itime;

				if(result==0){
					
					k=ii;
					goto lable;
				}
			}
		}
	lable: ;

		result=p+ptime*k;
		if(result-d>21252)
			result-=21252;
		result-=d;
		cout<<"Case "<<num<<": the next triple peak occurs in "<<result<<" days."<<endl;



		cin>>p>>e>>i>>d;
	}
	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