求助!(2023年12月GESP3级单位转换)
  • 板块题目总版
  • 楼主Ray_0601
  • 当前回复1
  • 已保存回复1
  • 发布时间2024/3/12 20:50
  • 上次更新2024/3/12 22:23:30
查看原帖
求助!(2023年12月GESP3级单位转换)
808707
Ray_0601楼主2024/3/12 20:50
#include <bits/stdc++.h>
using namespace std;

int dw(string x, string y)
{
	if(x == "km" && y == "m")	return 1000;
	else if(x == "km" && y == "mm")	return 1000000;
	else if(x == "m" && y == "mm") return 1000;
	if(x == "kg" && y == "g")	return 1000;
	else if(x == "kg" && y == "mg")	return 1000000;
	else if(x == "g" && y == "mg")	return 1000;
}

int num[1010];
string s1[1010], s2[1010];

int main()
{
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		char q;
		cin >> num[i] >> s1[i] >> q >> s2[i];
	}
	for(int i = 1; i <= n; i++)
	{
		cout << num[i] * dw(s1[i], s2[i]) << endl;
	}
	return 0;
}
2024/3/12 20:50
加载中...