Human vs Artificial Intelligence
All submissions for this problem are available.
The classic Two jug problem is to find out if, given 2 jugs, A and B of capacity Ca and Cb, is it possible to get a volume V in jug B.Considering the only moves being - FILLA, FILLB, POURA, POURB, EMPTYA, EMPTYB; where POURA means pouring the water from jug A to B untill either A is empty or B is full.
In a contest between human and Computers to test whether computers can beat humans in solving the problem in minimum moves, but the judges forgot the computers cannot cheat unless taught to. The participating human cheated as he was able to detect a half filled jug by tilting the jug till the base is just visible above the water level.Hence he could now perform 6 more operations - HFILLA, HFILLB, HPOURA, HPOURB, HEMPTYA, HEMPTYB; where HPOURA means the water from jug A is poured to jug B till jug B is half-filled, or A is empty.
Clearly proving the intelligence of Humans over computers the Human won many cases and others they tied.You need to write a program to detremine if for a given scenario the human won or it was a tie.
Problem Setter: Shahzor Khan
The first line of input gives the number of test cases, T(0 <= T <= 1000).Next T lines each describe 3 integers Ca, Cb and V,(1 <= Ca, Cb, V <=100) and (Ca<=Cb).
For each test case print "WIN BY X MOVES" or "TIED" without the quotes, X here refers to difference between nuber of moves of Human and Computer.
In case the computer didnt finish, X is number of moves for human to win.
Input: 2 3 5 4 4 8 1 Output: WON TIED.
Computer: FILLB POURB EMPTYA POURB FIILB POURB
Human: HFILLA HFILLB POURA
|Time Limit:||0.1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.5, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.