#include <bits/stdc++.h>
#define ll long long
#define sz(x) (int)x.size()
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
ll n;
cin >> n;
map<string, int> mp;
for(int i = 0; i < n; i++) {
string temp;
cin >> temp;
mp[temp]++;
}
bool ans = 1;
for(int i = 1; i <= 5; i++) {
int req = i / 5 + 1;
for(int j = 0; j < 3; j++) {
string act = "";
act += (char)(i + '0');
if(j == 0) act += "A";
else if(j == 1) act += "B";
else act += "C";
if(mp[act] < req) ans = 0;
}
}
if(ans) cout << "TAK";
else cout << "NIE";
}
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 | #include <bits/stdc++.h> #define ll long long #define sz(x) (int)x.size() using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); ll n; cin >> n; map<string, int> mp; for(int i = 0; i < n; i++) { string temp; cin >> temp; mp[temp]++; } bool ans = 1; for(int i = 1; i <= 5; i++) { int req = i / 5 + 1; for(int j = 0; j < 3; j++) { string act = ""; act += (char)(i + '0'); if(j == 0) act += "A"; else if(j == 1) act += "B"; else act += "C"; if(mp[act] < req) ans = 0; } } if(ans) cout << "TAK"; else cout << "NIE"; } |
English