'commit'
This commit is contained in:
36
TangDou/LuoGuBook/P5266.cpp
Normal file
36
TangDou/LuoGuBook/P5266.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
int n;
|
||||
string name;
|
||||
int opt, score;
|
||||
|
||||
unordered_map<string, int> _map;
|
||||
|
||||
int main() {
|
||||
cin >> n;
|
||||
while (n--) {
|
||||
cin >> opt;
|
||||
switch (opt) {
|
||||
case 1:
|
||||
cin >> name >> score;
|
||||
_map[name] = score;
|
||||
cout << "OK" << endl;
|
||||
break;
|
||||
case 2:
|
||||
cin >> name;
|
||||
if (_map.count(name) > 0) cout << _map[name] << endl;
|
||||
else cout << "Not found" << endl;
|
||||
break;
|
||||
case 3:
|
||||
cin >> name;
|
||||
if (_map.count(name) > 0) _map.erase(name), cout << "Deleted successfully" << endl;
|
||||
else cout << "Not found" << endl;
|
||||
break;
|
||||
case 4:
|
||||
cout << _map.size() << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user