1 条题解
-
0Tabing010102 (tabing) LV 0 MOD @ 2019-09-28 12:08:06
std
#include <iostream> #include <set> #include <string> using namespace std; set<string> s; int n, t; string ts; void find(string &ts) { int tl = ts.length(); for(int i = 0; i < tl; i++) if(ts[i] == '*') { for(int j = 'a'; j <= 'z'; j++) { ts[i] = j; //cout << "ts=" << ts << endl; if(s.count(ts)) { cout << "YES" << endl; return; } } cout << "NO" << endl; return; } if(s.count(ts)) { cout << "YES" << endl; return; } else { cout << "NO" << endl; return; } } int main() { cin >> n; for(int i = 0; i < n; i++) { cin >> t >> ts; if(t == 1) s.insert(ts); else find(ts); } return 0; }
- 1
信息
- ID
- 1004
- 难度
- 9
- 分类
- (无)
- 标签
- (无)
- 递交数
- 10
- 已通过
- 3
- 通过率
- 30%
- 上传者