U.S. Unit Conversion
InterviewTime limit1sMemory limit128 MB
Convert given values between kilograms/pounds and liters/gallons using fixed conversion factors, rounding to four decimal places.
- Level
Easy2 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
The United States commonly uses a different unit system from the metric system used in Korea. Write a program that converts between the following metric and U.S. customary units.
Only these conversions are needed: kilograms ↔ pounds and liters ↔ gallons. Use the values in the table below.
Input
The first line contains the number of test cases, T (1 <= T <= 1,000).
Each test case is given on one line. The first token is a value, and the second token is a unit. The value may be a decimal number and, if so, has at most four digits after the decimal point. The unit is one of kg, lb, l, and g, meaning kilograms, pounds, liters, and gallons, respectively.
Output
For each test case, print the converted value and unit. Round the value to exactly four digits after the decimal point.
The output unit is one of kg, lb, l, and g, using the same meanings as in the input description.