#1006. 单位转换
单位转换
说明
小杨这周的数学作业是做单位转换,喜欢编程的小杨决定编程帮他解决这些问题。
小杨只学了长度单位和重量单位,具体来说:
-
长度单位包括千米(
km
)、米(m
)、毫米(mm
),它们之间的关系是:<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><mtext>km</mtext><mo>=</mo><mn>1000</mn><mtext>m</mtext><mo>=</mo><mn>1000000</mn><mtext>mm</mtext></mrow></semantics></math>1km=1000m=1000000mm。 -
重量单位包括千克(
kg
)、克(g
)、毫克(mg
),它们之间的关系是:<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><mtext>kg</mtext><mo>=</mo><mn>1000</mn><mtext>g</mtext><mo>=</mo><mn>1000000</mn><mtext>mg</mtext></mrow></semantics></math>1kg=1000g=1000000mg。
小杨的作业只涉及将更大的单位转换为更小的单位,也就是说,小杨的作业只会包含如下题型:米转换为毫米,千米转换为毫米,千米转换为米,克转换为毫克,千克转换为毫克,千克转换为克。
现在,请你帮忙完成单位转换的程序。
输入格式
输入的第一行为一个整数,表示题目数量。
接下来 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>N 行,每行一个字符串,表示转换单位的题目,格式为 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>x 单位 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><mo>=</mo><mo stretchy="false">?</mo></mrow></semantics></math>1=? 单位 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>2</mn></mrow></semantics></math>2。其中,<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>x 为一个不超过 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1000</mn></mrow></semantics></math>1000 的非负整数, 单位 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn></mrow></semantics></math>1 和 单位 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>2</mn></mrow></semantics></math>2 分别为两个单位的英文缩写,保证它们都是长度单位或都是重量单位,且 单位 1 比 单位 2 更大。
例如,如果题目需要你将 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><mtext>km</mtext></mrow></semantics></math>1km 转换为 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mtext>mm</mtext></mrow></semantics></math>mm,则输入为 1 km = ? mm
。
保证 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><mo>≤</mo><mi>�</mi><mo>≤</mo><mn>1000</mn></mrow></semantics></math>1≤N≤1000。
输出格式
输出 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>N 行,依次输出所有题目的答案,输出时,只需要将输入中的 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">?</mo></mrow></semantics></math>? 代入答案,其余部分一字不差地输出即可。由于小杨的题目只涉及将更大的单位转换为更小的单位,并且输入的 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>x 是整数,因此答案一定也是整数。
例如,如果题目需要你将 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><mtext>km</mtext></mrow></semantics></math>1km 转换为 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mtext>mm</mtext></mrow></semantics></math>mm,则输入为 1 km = ? mm
。则你需要输出 1 km = 1000000 mm
。
样例
2
1 km = ? mm
1 m = ? mm
1 km = 1000000 mm
1 m = 1000 mm