Three water cups time limit:ms | Memory limit:65535 KB Difficulty:4
-
Describe
-
give three cups, different sizes, and only the largest cup of water is filled, the remaining two are empty cups. Three cups of water are poured between each other, and the cups are not identified and can only be calculated according to the volume of the cups given. You are now asked to write a program that outputs the minimum number of times that the initial state reaches the target State.
-
Input
-
The first line an integer n (0<n<50) indicates that the N group of test data next to each set of test data has two lines, the first row gives three integers V1 V2 V3 (v1>v2>v3 v1<100 v3>0) represents the volume of three cups. The second line gives three integers E1 E2 E3 (volume less than equal to the corresponding Cup volume) represents the final state we need
-
Output
-
Each row outputs the minimum number of water pours for the corresponding test data. If the target status output is not reached-1
-
Sample input
-
26 3 14 1 19 3 27 1 1
-
Sample output
-
3-1
Nyoj 213 cups of water