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

能不能给多一些容易出错的数据,我的不知道为什么wrong answer??

Posted by NicholasK at 2004-05-12 23:50:19 on Problem 1006
#include<fstream.h>

long peak(int p,int e,int i,int d){
	int l;
	long x=0;
	l=(d-p)/23+1;
	l=1>l?1:l;
	for(;x<21252;l++){
		x=23*l+p-d;
		if((23*l+p-e)%28==0)
			if((23*l+p-i)%33==0)
				return x;
	}
	return 21252;
}

int main()
{
	int p,e,i,d,n=1;
	ifstream fin;
	fin.open("in.txt");
	while(fin>>p,fin>>e,fin>>i,fin>>d,p>-1&&e>-1&&i>-1){
	cout<<"Case "<<n<<": the next triple peak occurs in "<<peak(p,e,i,d)<<" days."<<endl;
	n++;
	}
	fin.close();
	return 1;
}

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