?? 1135.cpp
字號:
/* This Code is Submitted by wywcgs for Problem 1135 on 2005-12-30 at 18:31:55 */
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAX = 32;
class Com {
public:
int a, b, r, g, c;
void make();
bool suit(const int) const;
};
void Com::make() {
scanf("%d %d %d", &c, &a, &b);
r = c - a, g = b - a;
}
bool Com::suit(const int n) const {
return ((n-a)%g == r);
}
int main()
{
Com com[MAX];
int n, y;
int i, t;
for(t = 1; scanf("%d", &n) != EOF && n != 0; t++) {
int m = 0, my = 0;
for(i = 0; i < n; i++) {
com[i].make();
if(com[m].g < com[i].g) m = i;
my = max(my, com[i].c);
}
for(y = com[m].c; y < 10000; y += com[m].g) {
if(my > y) continue;
for(i = 0; i < n; i++) {
if(!com[i].suit(y)) break;
}
if(i == n) break;
}
printf("Case #%d:\n", t);
if(y >= 10000) printf("Unknown bugs detected.\n\n");
else printf("The actual year is %d.\n\n", y);
}
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -