C++98:又是白居易诗里的“半江瑟瑟半江红”(你们懂)
查看原帖
C++98:又是白居易诗里的“半江瑟瑟半江红”(你们懂)
977778
__Harry_Haiyun__楼主2023/5/18 22:31
#include <bits/stdc++.h>
using namespace std;
char letter[27] = {1,'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
int main()
{
	string comet,team;
	int cometscore = 0,teamscore = 0;
	cin >> comet;
	cin >> team;
	for (int i = 0; i < comet.length(); i++)
	{
		for (int j = 1; j <= 26; j++)
		{
			if (comet[i] == letter[j]) cometscore *= j;
			break;
		}
	}
	for (int i = 0; i < team.length(); i++)
	{
		for (int j = 1; j <= 26; j++)
		{
			if (team[i] == letter[j]) teamscore *= j;
			break;
		}
	}
	if (cometscore == teamscore) cout << "GO" << endl;
	else cout << "STAY" << endl;
	return 0;
}
2023/5/18 22:31
加载中...