You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
876 B

#include <bits/stdc++.h>
using namespace std;
int main() {
int T;
cin >> T;
while (T--) {
int a;
cin >> a;
string dw;
cin >> dw;
char dh;
cin >> dh;
char wh;
cin >> wh;
string dw2;
cin >> dw2;
int sum = 0;
// 我天~可算是录完了
if (dw == "m")
sum = a * 1000;
else if (dw == "km" && dw2 == "mm")
sum = a * 1000000;
else if(dw=="km"&&dw2=="m")
sum = a * 1000;
else if(dw=="kg"&&dw2=="mg")
sum = a * 1000000;
else if(dw=="kg"&&dw2=="g")
sum = a * 1000;
else if(dw=="g")
sum = a * 1000;
//计算完成!!
cout << a << " " << dw << " = " <<sum<<" "<< dw2 << endl;
}
return 0;
}