为啥45红,没搞懂
查看原帖
为啥45红,没搞懂
828488
chhhhr楼主2022/10/22 18:49
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
typedef pair<string, string> PSS;

vector<PSS> a;
char b[110];
int main()
{
	int n, q;
	cin >> n >> q;
	string l, r;
	for (int i = 0; i < n; i ++)
	{
		cin >> l >> r;
		a.push_back({ l, r });
	}

	string ans, temp;
	int j = 0;
	for (int i = 0; i < q * 5; i++)
	{
		cin >> ans;
		for (auto ah : a)
		{
			if (ah.first == ans)
			{
				temp = ah.second;
				break;
			}
		}
		if (ans == temp) b[j++] = (char)(i % 5 + 64);
	}
	for (int i = 0; i < j; i++)
	{
		if (i == j - 1)
		{
			cout << b[i];
			break;
		}
		cout << b[i] << endl;
	}
	return 0;
}

2022/10/22 18:49
加载中...