为什么
查看原帖
为什么
1287887
_zhaosihan_qwq_楼主2024/10/13 10:17
#include<bits/stdc++.h>
using namespace std;
map<string,int> a;
string s; 
long long m,x,q,ans=0;
int main(){
	cin>>m;
	for(int i=0;i<m;i++){
		cin>>x;
		if(x==1){
			cin>>s;
			cin>> q;
			
			a[s]=q;
			cout<<"OK"<<endl;
		} 
		if(x==2){
			cin>>s;
			if(a[s]==0){
				cout<<"Not found"<<endl;
				continue;
			}
			cout<<a[s];
		}
		if(x==3){
			cin>>s;
			if(a.find(s)==a.end()){
				cout<<"Not found"<<endl;
				continue;
			}
			a.erase(s);
			cout<<"Deleted successfully"<<endl;
		}
		if(x==4){
			cout<<a.size()<<endl;
		}
	}
	return 0;
}

不对

2024/10/13 10:17
加载中...