为什么全WA掉了?样例能过的
查看原帖
为什么全WA掉了?样例能过的
579492
CZCCZC楼主2022/4/22 20:54
#include<bits/stdc++.h>
using namespace std ; 
long long n , opt , num , ans ; 
string name ; 
map <string , int> ds ; 
int main() {
	cin >> n ; 
	while(n--) {
		cin >> opt ; 
		if(opt == 1) {
			cin >> name >> num ; 
			ds[name] = num ; 
			cout << "OK" << endl ; 
		}
		else if(opt == 2) {
			cin >> name ; 
			if(ds.find(name) != ds.end())
				cout << ds[name] << endl ; 
			else cout << "Not found" << endl ; 
		}
		else if(opt == 3) {
			cin >> name ; 
			if(ds.find(name) != ds.end()) {
				ds.erase(ds.find(name)) ; 
				cout << "Deleted successfully" << endl ; 
			}
			else {
				cout << "Not found" << endl ; 
			}
		}
		else 
			cout << ans << endl ; 
	}
	return 0 ;
}
2022/4/22 20:54
加载中...