mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 03:31:59 +00:00
P5266 【深基17.例6】学籍管理
R39714409
This commit is contained in:
parent
0503a0264c
commit
2a952a8412
41
problem/P5266/P5266.cpp
Normal file
41
problem/P5266/P5266.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int n, q, a, b;
|
||||
string s;
|
||||
map<string, int> students;
|
||||
cin >> n;
|
||||
while (n--) {
|
||||
cin >> q;
|
||||
if (q == 1) {
|
||||
cin >> s >> b;
|
||||
students[s] = b;
|
||||
cout << "OK" << endl;
|
||||
}
|
||||
else if (q == 2) {
|
||||
cin >> s;
|
||||
if (students.find(s) != students.end()) {
|
||||
cout << students[s] << endl;
|
||||
}
|
||||
else {
|
||||
cout << "Not found" << endl;
|
||||
}
|
||||
}
|
||||
else if (q == 3) {
|
||||
cin >> s;
|
||||
if (students.find(s) != students.end()) {
|
||||
students.erase(s);
|
||||
cout << "Deleted successfully" << endl;
|
||||
}
|
||||
else {
|
||||
cout << "Not found" << endl;
|
||||
}
|
||||
}
|
||||
else if(q == 4) {
|
||||
cout << students.size() << endl;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user