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.

32 lines
785 B

1 year ago
#include <bits/stdc++.h>
using namespace std;
/**
2
1 km = ? mm
1 m = ? mm
*/
int main() {
int m;
cin >> m;
while (m--) {
int a;
cin >> a; // 第一个数字
string b;
cin >> b; // 第一个单位
string c, d; // 等号与问号
cin >> c >> d; // 用不上,只读不用
string e;
cin >> e; // 第二个单位
if (b[0] == 'k') {
1 year ago
if (e.size() == 1) // m , mm; g,mg;
1 year ago
cout << a << " " << b << " = " << a * 1000 << e << endl;
else
cout << a << " " << b << " = " << a * 1000000 << e << endl;
} else {
cout << a << " " << b << " = " << a * 1000 << e << endl;
}
}
return 0;
}