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

哪位能提供一些测试数据,我的代码wa

Posted by fanrongqi at 2011-01-18 19:05:44 on Problem 1044
代码如下;




#include <iostream>

using namespace std;
int main()
{
	int y[20],a[20],b[20];
    int i;
	int n;
	int yearbegin=0;
	int temp;
	int count=1;
//     n=2;
//   	y[0]= 1998;a[0]= 1900;b[0]=2000 ;
//   	y[1]=  1999 ;a[1]= 1900;b[1]= 2000;

	while(1){ 
  		cin>>n;
 		if (n==0){
			break;
 		}

  		for (i=0;i<n;i++)
  		{
  			cin>>y[i]>>a[i]>>b[i];
  		}
 
		for (i=0;i<n;i++)
		{
			if (yearbegin>b[i])
			{
				yearbegin=b[i];
			}
		}
         //yearbegin= 2140;
		while(yearbegin<9999){
            
			for (i=0;i<n;i++){
				temp=yearbegin-b[i]+a[i];
				while(temp>b[i]){
					temp=temp-b[i]+a[i];
				}
				if (temp!=y[i])	{
					break;
				}
			}

			if (i==n)
			{
				cout<<"Case #"<<count<<":"<<endl;
				cout<<"The actual year is "<<yearbegin<<"."<<endl;
				count++;
				break;
			}
			yearbegin++;
		}//while(yearbegin<9999)

		if (yearbegin==9999)
		{
			cout<<"Case #"<<count<<":"<<endl;
		    cout<<"Unknown bugs detected."<<endl;
			count++;
		}
	}//	while(y[0]!=0)

	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