for
æã®ç·´ç¿åé¡
åé¡æ¦è¦
é·ãã®çãã 2 ã¤ã®æåå ãä¸ããããã
ã«å«ã¾ããåæå '@' ã«ã¤ãã¦ã'a', 't', 'c', 'o', 'd', 'e', 'r' ã®ããããã«ç½®ãå¤ãããã¨ã§ã ãä¸è´ããããã«ã§ããããå¤å®ããã
å¶ç´
- [tex 1 \le |S| = |T| \le 10]
èãããã¨
for
æãåãã¦ãåæå S[i]
, T[i]
ã«ã¤ãã¦å¤å®ãã¦ããã°ããã
S[i] == T[i]
ã®ã¨ãï¼OKï¼ä¸¡æ¹ã '@' ã§ããå ´åãå«ã)S[i], T[i]
ã®çæ¹ã '@' ã§ãããçæ¹ã®æåã a, t, c, o, d, e, r ã®ããããã®ã¨ãï¼OK- ãã以å¤ã®ã¨ãï¼NG
ã¨ããæãã§ãã¸ãã¯ãçµãã°ããã
ã³ã¼ã
#include <bits/stdc++.h> using namespace std; set<char> atcoder({'a', 't', 'c', 'o', 'd', 'e', 'r'}); int main() { string S, T; cin >> S >> T; bool res = true; for (int i = 0; i < S.size(); i++) { if (S[i] == T[i]) continue; if (S[i] == '@' && atcoder.count(T[i])) continue; if (T[i] == '@' && atcoder.count(S[i])) continue; res = false; } if (res) cout << "You can win" << endl; else cout << "You will lose" << endl; }