问题描述 |
---|
Give three cups, size is differ, and only one of the largest glass is filled with water, the other two empty cup. Between the three cups water, and water glass without tags, can only be calculated according to water volume. Now you are asked to write a program to make the output of the initial state to goal state minimum number. |
输入描述 |
The first line of an integer N (0 < N < 50) said N group of test data The next test data have two lines in each group, the first line are three integers V1 V2 V3 (V1 > V2 > V3 V1 < 100 V3 > 0) said the three water volume. The second line gives three integer E1, E2, E3 (volume is less than or equal to the corresponding water volume) said we need a final state |
输出描述 |
Each row of the output corresponding test data with the least number of water. If can not meet the target state output -1 |
样例输入复制样例 |
2 6 3 1 4 1 1 9 3 2 7 1 1 |
样例输出 |
3 -1 |
相关 |