标签:include https name loading stream ble map style i++
https://www.luogu.com.cn/problem/P5266
使用map记录数据,注意map以下函数的使用
#include<iostream> #include<cstdio> #include<string> #include<cstring> #include<map> using namespace std; map<string, int>e; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int a, b; string c; cin >> a; if (a != 4)cin >> c; if (a == 1) { cin >> b; e[c] = b; cout << "OK" << endl; } else if (a == 2) { if (!e.count(c))cout << "Not found" << endl; else cout << e[c] << endl; } else if (a == 3) { if(e.count(c)){ e.erase(c); cout << "Deleted successfully" << endl; } else cout << "Not found" << endl; } else cout << e.size()<<endl; } }
标签:include https name loading stream ble map style i++
原文地址:https://www.cnblogs.com/Jason66661010/p/13205141.html