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

请指教:为什么下面这段程序在VC++上没问题,在这里总是WRONG ANSWER???急死人了啊~~~

Posted by 10317011 at 2004-01-17 11:24:50 on Problem 1006
#include <iostream.h>
#include <stdlib.h>
void main()
{
	int p=0,e=0,i=0,d=0,temp,count=1;
	cin>>p>>e>>i>>d;
	if(p>365||e>365||i>365||d>365||p<0||e<0||i<0||d<0)
		exit(0);
	while(p!=-1&&e!=-1&&i!=-1&&d!=-1)
	{
		p=p%365;e=e%365;i=i%365;d=d%365;
		temp=23;
		if(temp<p)
			temp=p+1;
		while((temp-p)%23!=0)
		{temp++;}
		while((temp-e)%28!=0)
			temp=temp+23;
		while((temp-i)%33!=0)
			temp=temp+23*28;
		temp=temp-d;
		if(temp<=0)
			temp=temp+21252;
		if(temp>21252)
			temp=temp%21252;
		cout<<"Case "<<count<<": the next triple peak occurs in "<<temp<<" days."<<endl;	
		count++;
		cin>>p>>e>>i>>d;
		if(p>365||e>365||i>365||d>365||p<0||e<0||i<0||d<0)
			exit(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