#10034. 「一本通 2.1 例 2」图书管理

链接:Miku

--------------------

一个map干过去

-------------------

#include <map>
#include <cstring>
#include <cstdio>
#include <cstdio>
#include <algorithm>
#include <iostream>
using namespace std;
string s, now;
int n;
map<string, bool> m;
int main() {
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> now;
        //    cout<<now;
        if (now == "add") {
            getline(cin, s);
            //        cout<<s;
            m[s] = 1;
        } else {
            getline(cin, s);
            if (m[s])
                cout << "yes" << endl;
            else
                cout << "no" << endl;
        }
    }
    return 0;
}
Ac

 

 
posted @ 2020-07-30 16:05  Simex  阅读(122)  评论(0编辑  收藏  举报