样例下载对的,洛谷全WA
查看原帖
样例下载对的,洛谷全WA
1122193
FarmerDrone楼主2024/3/12 21:46
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
	int n, p, ans;
	map <string, int> ds;
	cin >> n >> p;
	for (int i = 0; i < n; i++)
	{
		string str;
		int b;
		cin >> str >> b;
		ds[str] = b;
	}
	string str;
	while (!cin.eof())
	{
		cin >> str; 
		string cpy = "";
		for (int i = 0; i < str.size(); i++)
			if (str[i] != '!' && str[i] != '?' && str[i] != '.' && str[i] != ',')
				cpy += str[i];
		ans += ds[cpy];
		ans %= p;
	}
	cout << ans << endl;
	return 0;
}
2024/3/12 21:46
加载中...