![在这里插入图片描述](https://img-blog.csdnimg.cn/97891b3cd94f4c3ebf16d4fcd6c969f4.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3d3Zl81NDUw,size_16,color_FFFFFF,t_70)
#include<bits/stdc++.h>
#include<map>
using namespace std;
int n,opt,score;
string name;
map <string,int> stu;
int main(){
cin>>n;
while(n--){
cin>>opt;
if(opt==1){
cin>>name>>score;
stu[name]=score;
cout<<"OK"<<endl;
}
else if(opt==2){
cin>>name;
if(stu.count(name)){
cout<<stu[name]<<endl;
}
else{
cout<<"Not found"<<endl;
}
}
else if(opt==3){
cin>>name;
if(stu.count(name)){
stu.erase(name);
cout<<"Delete successfully"<<endl;
}
else {
cout<<"Not found"<<endl;
}
}
else{
cout<<stu.size()<<endl;
}
}
return 0;
}
#include<iostream>
#include<cstring>
#include<map>
using namespace std;
map <string,int> a;
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++){
int op;
string name;
cin>>op;
if(op!=4)
cin>>name;
switch(op){
case 1:
int score;
cin>>score;
a[name]=score;
cout<<"OK\n";
break;
case 2:
if(a.count(name))
cout<<a[name]<<endl;
else cout<<"Not found\n";
break;
case 3:
if(a.count(name)){
a.erase(name);
cout<<"Deleted successfully\n";
}
else cout<<"Not found\n";
break;
case 4:
cout<<a.size()<<endl;
}
}
return 0;
}