#include <iostream> #include <algorithm> #include <vector> using namespace std; vector<string> w; bool jest(string s, int ile) { int a=0; for (int i=0; i<w.size(); ++i) if (s==w[i]) ++a; return ile<=a; } int main() { ios_base::sync_with_stdio(false); int n; cin>>n; for (int i=0; i<n; ++i) { string s; cin>>s; w.push_back(s); } for (int i=1; i<=5; ++i) for (char c='A'; c<='C'; ++c) { string s=" "; s[0]='0'+i; s[1]=c; if (!jest(s, i==5 ? 2 : 1)) { cout<<"NIE\n"; return 0; } } cout<<"TAK\n"; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #include <iostream> #include <algorithm> #include <vector> using namespace std; vector<string> w; bool jest(string s, int ile) { int a=0; for (int i=0; i<w.size(); ++i) if (s==w[i]) ++a; return ile<=a; } int main() { ios_base::sync_with_stdio(false); int n; cin>>n; for (int i=0; i<n; ++i) { string s; cin>>s; w.push_back(s); } for (int i=1; i<=5; ++i) for (char c='A'; c<='C'; ++c) { string s=" "; s[0]='0'+i; s[1]=c; if (!jest(s, i==5 ? 2 : 1)) { cout<<"NIE\n"; return 0; } } cout<<"TAK\n"; return 0; } |