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

谁能帮我看一下这个程序哪错了啊?1006题

Posted by 15849119680 at 2010-03-10 23:19:08
#include<iostream>
using namespace std;
int main()
{
	int p,e,i,d;
	int p1,e1,i1,n=1;
	cin>>p>>e>>i>>d;
	while(p!=-1||e!=-1||i!=-1||d!=-1)
	{
		if(p<0||e<0||i<0||d<0||p>365||e>365||i>365||d>365)
		{
			cout<<"wrong input"<<endl;
		}
		else
		{
	      p1=p%23;
	      e1=e%28;
	      i1=i%33;
	for(int k=1;;k++)
	{
        if(k%23==p1&&k%28==e1&&k%33==i1)
		{
			cout<<"Case "<<n<<": the next triple peak occurs in "<<k-d<<" days."<<endl;
			n++;
		break;
		}
	}
		}
        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