全WA,0pts玄关求调
查看原帖
全WA,0pts玄关求调
1350908
gjrBJ楼主2025/6/20 21:29

求大佬回复!必关!!

#include<bits/stdc++.h>
using namespace std;
map<string, int> mp;
string s;
int n, op, scr, len;
int main() {
	cin >> n;
	while (n--) {
		cin >> op;
		if (op == 1) {
			cin >> s >> scr;
			mp[s] = scr;
			cout << "OK" << endl;
			len++;
		} else if (op == 2) {
			cin >> s;
			if (mp[s] != 0) {
				cout << mp[s] << endl;
			} else {
				cout << "Not found" << endl;
			}
		} else if (op == 3) {
			cin >> s;
			if (mp.find(s)!=mp.end()) {
				mp[s] = 0;
				cout << "Deleted successfully" << endl;
				len--;
			} else {
				cout << "Not found" << endl;
			}
		} else {
			cout << max(len, 0) << endl;
		}
	}
	return 0;
}
2025/6/20 21:29
加载中...