## DWITE '08 R3 #3 - Unicorns and Teaspoons

View as PDF

Points: 5
Time limit: 2.0s
Memory limit: 64M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
##### DWITE Online Computer Programming Contest, December 2008, Problem 3

Google's calculator works with some pretty weird units of measure. Have you tried searching for a value of the answer to life the universe and everything / number of horns on a unicorn? (btw, it's 42) We'll try to work with just the imperial units of volume for now.

You'll need this table of conversions:

 5 fluid ounce (oz) 1 gill (gill) 4 gill (gill) 1 pint (pt) 2 pint (pt) 1 quart (qt) 4 quart (qt) 1 gallon (gal)

The input will contain 5 lines in a format of: value unit1 in unit2, where the goal is to convert from unit1 to unit2, for a given value. . Units are expressed as keys inside brackets in the table above.

The output will contain 5 integers -- the converted values. The supplied input will always work out to be an integer answer.

#### Sample Input

10 oz in gill
20 oz in pt
2 gal in oz
1 gal in qt
2 pt in pt

#### Sample Output

2
1
320
4
2