Woburn Challenge 2001 - Suicidal
Ah, it's the end of frosh week and love is in the air. New couples are forming everywhere and everyone is happy. Hi, I'm Roger Lodge. Let's meet our couple, shall we? Simon is a Computer Engineering frosh who has a "fetish" for precision. His favourite books are "Advanced Number theory" and "The Hermit, The Hospital and The Place: baby names for mathematicians". Simone is an electrical engineering frosh who likes sparks to fly on the first date. She likes to mix psychology with physics and is currently reading "Jung on Young" and "Freud and the solenoid". Yikes.
Simon and Simone are at dinner. When their drinks (i.e. beer) arrive, it
is in a large glass that holds
These
Since the jugs are not calibrated, the only way that he can know how
much volume he is pouring is by emptying a jug fully or filling another
jug fully. Dr. Love says that Simon hasn't been to the gym in a while
(he's been too busy reading early
Input Specification
-1 -1
denotes end of input)
Bonus
Josh, another Waterloo keener, has solved this program for
Output Specification
infinity
if it isn't possible to split the beer evenly)
Sample Input
2 1
3 1
-1 -1
Sample Output
3
infinity
Comments