全WA求助
查看原帖
全WA求助
1241049
XiaoYanYa楼主2024/5/26 16:58
#include<iostream>
#include<cmath>
#include<cstring>
#include<ctime>
#include<algorithm>
#include<queue>
#include<stack>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t)
	{
		string a,b;
		int n;
		char x,y;
		int m;
		cin>>n>>a>>x>>y>>b;
		if(a=="km")
		{
			if(b=="mm")    m=2;
			else    m=3;
		}
		else if(a=="kg")
		{
			if(b=="mg")    m=5;
			else    m=6;
		}
		else if(a=="m")
		{
			m=1;
		}
		else
		{
			m=4;
		}
		cout<<m;
		if(m==1)//m to mm
		{
			printf("%d m = %d mm\n",n,n*1000);
		}
		if(m==2)//km to mm
		{
			printf("%d km = %d mm\n",n,n*1000000);
		}
		if(m==3)//km to m
		{
			printf("%d km = %d m\n",n,n*1000);
		}
		if(m==4)//g to mg
		{
			printf("%d g = %d mg\n",n,n*10000);
		}
		if(m==5)//kg to mg
		{
			printf("%d kg = %d mg\n",n,n*1000000);
		}
		if(m==6)//kg to g
		{
			printf("%d kg = %d g\n",n,n*1000);
		}
		t--;
	} 
	
	return 0;
}

2024/5/26 16:58
加载中...