题目描述
![](https://i-blog.csdnimg.cn/blog_migrate/e2d8b75719e7e39a6a74759a9bd90fec.png)
样例输入
2
1 km = ? mm
1 m = ? mm
样例输出
1 km = 1000000 mm
1 m = 1000 mm
AC代码
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
long long m;
string dw,a,b,dw1;
for(int i=1;i<=n;i++){
cin>>m>>dw>>a>>b>>dw1;
if(dw=="km"&&dw1=="m"){
cout<<m<<" "<<dw<<" "<<a<<" "<<m*1000<<" "<<dw1<<endl;
}else if(dw=="kg" && dw1=="g"){
cout<<m<<" "<<dw<<" "<<a<<" "<<m*1000<<" "<<dw1<<endl;
}else if(dw=="kg" && dw1=="mg"){
cout<<m<<" "<<dw<<" "<<a<<" "<<m*1000000<<" "<<dw1<<endl;
}else if(dw=="km" && dw1=="mm"){
cout<<m<<" "<<dw<<" "<<a<<" "<<m*1000000<<" "<<dw1<<endl;
}else if(dw=="m" && dw1=="mm"){
cout<<m<<" "<<dw<<" "<<a<<" "<<m*1000<<" "<<dw1<<endl;
}
else{
cout<<m<<" "<<dw<<" "<<a<<" "<<m*1000<<" "<<dw1<<endl;
}
}
return 0;
}