Special equationsTime
limit:1000MS
Memory Limit:32768KB
64bit IO Format:%i64d &%i64 U SubmitStatusPracticeHDU 4569
Description
Let f (x) = a nx n +...+ a 1x +a 0, in which a I (0 <= i <= N) is all known integers. We call F (x) 0 (mod m) congruence equation. If M is a composite, we can factor m to powers of primes and solve every such single equation after which we merge them Using the Chinese Reminder theorem. In this problem, you is asked to solve a much simpler version of the such equations, with the m to be prime ' square.
Input
The first line is the number of equations T, t<=50.
Then comes T-lines, each line starts with a integer deg (1<=deg<=4), meaning that f (x) ' s degree are deg. Then follows deg integers, representing a n to a 0 (0 < ABS (A-N) <=, ABS (a i) <= 10000 when deg >= 3, othe Rwise ABS (a i) <= 100000000, i<n). The last integer is Prime pri (pri<=10000).
Remember, your task is to solve F (x) 0 (mod pri*pri)
Output
For each equation f (x) 0 (mod pri*pri), first output the case number, then output anyone of X if there is many X fitting The equation, else output "No solution!"
Sample Input
42 1 1-5 71 5-2995 99292 1-96255532 8930 98114 14 5458 7754 4946-2210 9601
Sample Output
Case #1: No solution! Case #2:599Case #3:96255626Case #4: No solution!
HDU 4569 Special equations (modulo)