这道题就是个水题.只要能读懂英语就会做了...非常简单,,但是由于想的不够周到,WA了很多次,,最后才AC..代码如下:
#include<iostream>
using namespace std;
typedef struct NODE
{
int year,dic;
}Node[20];
int main()
{
int n,i,j,m=1;
while(cin>>n&&n)
{
Node N;
int x,y;
for(i=0;i<n;i++)
{
cin>>N[i].year>>x>>y;
N[i].dic=y-x;
}
printf("Case #%d:\n",m++);
while(N[0].year<10000)
{
for(i=1;i<n;i++)
if((N[0].year-N[i].year)%N[i].dic!=0) break;
if(i==n)
{
for(j=1;j<n;j++)
if(N[j].year>N[0].year) break;
if(j==n) {printf("The actual year is %d.\n",N[0].year);break;}
}
N[0].year+=N[0].dic;
}
if(N[0].year>=10000) cout<<"Unknown bugs detected."<<endl;
cout<<endl;
}
return 0;
}