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 pdfpdf at 2006-02-27 20:16:17 on Problem 1006
觉得没错的说……大虾们指教一下……谢谢!!!
#include<iostream>
using namespace std;
int main()
{
	int p,e,i,d,n=0,s=0;
	for(;;){
		cin>>p>>e>>i>>d;
		if(p==-1&&e==-1&&i==-1&&d==-1)break;
		n++;
		if(p==e&&e==i&&i==d)s=p+21252;
		else{
			while(p!=e){
				if(p<e)p+=23;
				else e+=28;
			}
			while(p!=i){
				if(p<i)p+=644;
				else i+=33;
			}
			s=i%21252;
			if(s<d)s+=21252;
		}
		cout<<"Case "<<n<<": the next triple peak occurs in "
			<<(s-d)<<" 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