[BOJ 14013] Unit Conversion
View as PDF
Submit solution
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text
Points:
1
Time limit:
2.0s
Memory limit:
512M
Problem types
Allowed languages
"How do you say 'two kilos' in English? -- Dudu, 2015</p>
Dudu always had trouble with measurements and unit conversions. Can you help him?
입력 형식
The input will begin with a line containing 2 numbers x and y meaning that "x of unit A" is equal to "y of unit B". For instance, if A is "kilos" and B is "pounds" one possibility is x = 3.25 and y = 7.165024.</p>
The next line will contain a single integer N, containing the number of conversions to be performed.
Each of the next N lines will be of the form "z q" where z is a number and q is either 'A' or 'B'.
- 1 ≤ N ≤ 100000
- x,y are strictly positive numbers
- z is a nonnegative number
Output N lines with a number each. See the sample input/output for further details.
예제 입력
3.25 7.165024
5
3.25 A
1 A
0 B
2.1 B
0 A
예제 출력
7.165024
2.20462277
0.000000000000000
0.952543913321
0.000000000000000
힌트
Errors smaller than 10-4 will be considered correct.
- 3.25 A = 7.165024 B
- 1 A = 2.20462277 B
- 0 B = 0 A
- 2.1 B = 0.952543913321 A
- 0 A = 0 B
Comments