#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vii; typedef vector<ll> vll; typedef vector<vector<int> > vvi; typedef pair<int, int> pii; typedef pair<ll, ll> pll; int main(){ cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<int> t(15,0); for(int i = 0; i < n; i++){ string s; cin >> s; t[(int)(s[0]-'1')*3+(int)(s[1]-'A')]++; } bool ok = true; for(int i = 0; i < 12; i++) ok = ok && (t[i]>0); for(int i = 12; i < 15; i++) ok = ok && (t[i]>1); cout << (ok? "TAK\n" : "NIE\n"); }
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 | #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vii; typedef vector<ll> vll; typedef vector<vector<int> > vvi; typedef pair<int, int> pii; typedef pair<ll, ll> pll; int main(){ cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<int> t(15,0); for(int i = 0; i < n; i++){ string s; cin >> s; t[(int)(s[0]-'1')*3+(int)(s[1]-'A')]++; } bool ok = true; for(int i = 0; i < 12; i++) ok = ok && (t[i]>0); for(int i = 12; i < 15; i++) ok = ok && (t[i]>1); cout << (ok? "TAK\n" : "NIE\n"); } |