链接: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

相关文章:

  • 2021-12-17
  • 2021-11-27
  • 2022-02-17
  • 2022-01-01
  • 2022-02-22
  • 2021-12-21
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-02
  • 2022-12-23
  • 2021-11-06
相关资源
相似解决方案