样例一什么情况
查看原帖
样例一什么情况
1104948
cc_lucky楼主2024/11/11 16:53
#include<bits/stdc++.h>
using namespace std;
unordered_map<string, int>mp;
bool broke, soha_says;
int brokeid, tot;
string message, soha, broker;
string AITer() {
	string s = "";
	for (int i = 0; i < (int)message.size(); i++) {
		if (message[i] == '@') {
			s = "yyy loves ";
			i += 11;
			while (message[i] != ' ' && i < (int)message.size()) s += message[i], i++;
			return s;
		}
	}
}
string Talker() {
	string s = "";
	for (int i = 0; i < (int)message.size(); i++) {
		if (message[i + 1] == ':') break;
		s += message[i];
	}
	return s;
}
bool Check() {
	int AITs = 0;
	for (int i = 0; i < (int)message.size(); i++) {
		if (message[i] == '@') AITs++;
	}
	if (AITs > 1) return 0;
	string s = AITer();
	if (s != soha) return 0;
	return 1;
}
int main() {
	while (1) {
		getline(cin, message);
		if (message == "") break;
		string talker = Talker();
		if (!mp.count(talker)) mp[talker] = ++tot; 
		if (soha == "") soha = AITer();
		else {
			if (talker == soha) soha_says = 1;
			else {
				if (!Check()) {
					broke = 1;
					brokeid = mp[talker];
					broker = talker;
				}
			}
		}
	}
	if (broke) cout << "Unsuccessful @" << soha << " attempt\n" << brokeid << "\n" << broker;
	else {
		if (soha_says) cout << "Successful @" << soha << " attempt";
		else cout << "Unsuccessful @" << soha << " attempt\nGood Queue Shape";
	}
}

这明明能过样例1啊

2024/11/11 16:53
加载中...