|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|1 초||128 MB||1||0||0||0.000%|
James-the-locksmith thought he had seen them all until he was called to unlock this one. It was a lock displayed on a screen mounted on the fridge door.
The lock can be set to have K, 3 < K < 10, concentric rings with each ring having a set of N numbers displayed on it, where 2 < N < 50. The fridge door can be unlocked by selecting one number from each ring such that the K numbers satisfy K given clues. Each of the K clues is a relation between the numbers to be selected.
Here is an example with K having a value of three:
The selection of 10 in the outer ring, 5 in the middle ring, and 2 in the inner ring in order will unlock the door.
Your task is to write a program that reads the numbers and the clues, and prints out the selection of numbers needed to unlock the door. Each clue will be given to you as a linear algebraic expression, described below, as we do not believe that you fancy parsing the clues yourself. The above clues would be written as:
Router - 2 Rmiddle + 0 Rinner = 0 0 Router + Rmiddle + Rinner = 7 - Router + Rmiddle + 3 Rinner = 1
The input consists of many test cases. The description of each test case consists of:
The values of all numbers displayed on the rings and of all coefficients in the clues are between 1 and 99, inclusive.
A zero on a line by itself indicates the end of input and should not be processed.
For each test case print the numbers from each ring needed to open the lock on a line by themselves. The answer is to be listed from the outer ring to the inner-most ring.
3 11 4 2 15 7 10 9 2 4 8 1 12 7 11 6 5 3 4 1 13 2 14 1 -2 0 = 0 0 1 1 = 7 -1 1 3 = 1 0
10 5 2