#34217:


aa613613613 (coffeesun)

學校 : 國立彰化師範大學
編號 : 119242
來源 : [163.19.184.254]
最後登入時間 :
2024-02-21 08:07:37
a541. 字典 | From: [120.104.245.130] | 發表日期 : 2023-03-06 11:05

#include <iostream> #include <set> #include <string> using namespace std; int main() { int n, q; cin >> n; set<string> words; for (int i = 0; i < n; i++) { string word; cin >> word; words.insert(word); } cin >> q; for (int i = 0; i < q; i++) { string query; cin >> query; if (words.count(query)) { cout << "yes" << endl; } else { words.insert(query); cout << "no" << endl; } } return 0; }

 
ZeroJudge Forum