2013
12-12

# Guess the number

Happy new year to everybody!
Now, I want you to guess a minimum number x betwwn 1000 and 9999 to let
(1) x % a = 0;
(2) (x+1) % b = 0;
(3) (x+2) % c = 0;
and a, b, c are integers between 1 and 100.
Given a,b,c, tell me what is the number of x ?

The number of test cases c is in the first line of input, then c test cases followed.every test contains three integers a, b, c.

For each test case your program should output one line with the minimal number x, you should remember that x is between 1000 and 9999. If there is no answer for x, output "Impossible".

2
44 38 49
25 56 3

Impossible
2575

mark：应该是用剩余定理的，不过数据那么小，直接爆了。

# include <stdio.h>

int main ()
{
int T, a, b, c, i ;
scanf ("%d", &T) ;
while (T--)
{
scanf ("%d%d%d", &a, &b, &c) ;
for (i = 1000 ;  i<= 9999 ; i++)
if (i%a == 0 && (i+1)%b == 0 && (i+2)%c==0) break ;
if (i == 10000) puts ("Impossible") ;
else printf ("%d\n", i) ;
}
return 0 ;
}

1. 话说，想看火影的恋爱，最新的两个剧场版不就描写的鸣人和雏田恋爱么。还一个婚后生活的。当然了，主题不是日常恋爱，秀恩爱的时间肯定不多，不过也比这好多了。

2. 这个方法是错的，不信你试试：
20 5
1 A:9
1 A:9
1 A:9
1 A:6
1 A:4
正确答案应该是19，这个答案是18