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 15816544677 at 2013-12-21 14:24:54 on Problem 1006
#include<iostream>
using namespace std;
#define NUM 1000
int main()
{
	int p,e,i,d,k=0,num[NUM],n=0;
	cin>>p>>e>>i>>d;
	while(!(p==-1&&e==-1&&i==-1&&d==-1))
	{
		if(p>365||e>365||i>365||d>365) return 0;
		k=d+1;
		for(;k<=21252;k++)
		{	
			if(((k-p)%23)==0&&((k-e)%28)==0&&((k-i)%33)==0)
			   	break;
		}
		num[n++]=k-d;
		cin>>p>>e>>i>>d;
		k=0;
	}
	for(int j=0;j<n;j++)
	{
		if(num[j]<=0) num[j]+=21252;
		cout<<"Case "<<j+1<<": the next triple peak occurs in "<<num[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