一起加油hh...
下面贴个 map 的 ac 代码
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
map<string,int> mp;
int main()
{
int n;
cin >> n;
for(int i=0;i<n;i++)
{
int op;
cin >> op;
string name;
if(op != 4) cin >> name;
if(op == 1)
{
double sc;
cin >> sc;
mp[name] = sc;
cout << "OK" << endl;
}else if(op == 2)
{
if(mp.count(name)) cout << mp[name] << endl;
else cout << "Not found" << endl;
}else if(op == 3)
{
if(mp.count(name))
{
mp.erase(name);
cout << "Deleted successfully" << endl;
}
else cout << "Not found" << endl;
}else cout << mp.size() << endl;
}
return 0;
}