| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
哪位能提供一些测试数据,我的代码wa代码如下;
#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator