#include <iostream>
#include <string>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
string s;
int n, i, j;
int ile[5][3] = {0};
cin >> n;
for (i = 0; i < n; ++i) {
cin >> s;
ile[s[0] - '1'][s[1] - 'A']++;
}
bool czy = true;
for (i = 0; i < 4; ++i)
for (j = 0; j < 3; ++j)
if (ile[i][j] == 0)
czy = false;
for (i = 0; i < 3; ++i)
if (ile[4][i] < 2)
czy = false;
if (czy)
cout << "TAK" << endl;
else
cout << "NIE" << endl;
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 | #include <iostream> #include <string> using namespace std; int main() { ios_base::sync_with_stdio(0); string s; int n, i, j; int ile[5][3] = {0}; cin >> n; for (i = 0; i < n; ++i) { cin >> s; ile[s[0] - '1'][s[1] - 'A']++; } bool czy = true; for (i = 0; i < 4; ++i) for (j = 0; j < 3; ++j) if (ile[i][j] == 0) czy = false; for (i = 0; i < 3; ++i) if (ile[4][i] < 2) czy = false; if (czy) cout << "TAK" << endl; else cout << "NIE" << endl; return 0; } |
English