AC题解
2026-10-04 19:18:35
发布于:江苏
0阅读
0回复
0点赞
如下:
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;cin>>n;
for(int i=0;i<n;i++){
int x;string s1,s2,q,p;//q:储存“=”p:储存“?”
cin>>x>>s1>>q>>p>>s2;
long long re=0;
if(s1=="km" and s2=="m"){re=x*1000;}
else if(s1=="km" and s2=="mm"){re=x*1000000;}
else if(s1=="m" and s2=="mm"){re=x*1000;}
else if(s1=="kg" and s2=="g"){re=x*1000;}
else if(s1=="kg" and s2=="mg"){re=x*1000000;}
else if(s1=="g" and s2=="mg"){re=x*1000;}//逐个判断
cout<<x<<' '<<s1<<" = "<<re<<" "<<s2<<endl;//输出
}
这里空空如也








有帮助,赞一个