#K50472. Unit Conversion and Summation
Unit Conversion and Summation
Unit Conversion and Summation
You are given several measurement conversion requests. Each test case consists of four parts: the measurement type (either weight
or height
), a numeric value, the source unit, and the target unit. Your task is to convert the given value using the appropriate conversion factor and output the integer part of the converted value.
The conversion rules are as follows:
- Weight conversions:
- \(1\,kilogram = 1000\,grams\)
- \(1\,kilogram \approx 2.20462\,pounds\)
- \(1\,pound \approx 453.592\,grams\)
- Height conversions:
- \(1\,meter = 100\,centimeters\)
- \(1\,meter \approx 39.3701\,inches\)
- \(1\,inch \approx 2.54\,centimeters\)
For each test case, perform the conversion and output the integer part (truncate any decimals) of the result.
inputFormat
The input is read from stdin. The first line contains an integer (T) representing the number of test cases. Each of the following (T) lines contains a test case in the following format:
measurement_type value source_unit target_unit
where measurement_type
is either weight
or height
.
outputFormat
For each test case, output a single line to stdout containing the integer part of the converted value.## sample
1
weight 10 kilograms grams
10000