#include <bits/stdc++.h>
using namespace std;
int n;
int jest[5][3];
int main ()
{
cin >> n;
for (int i = 0; i < n; i++)
{
int a;
char b;
scanf("%d%c", &a, &b);
jest[a - 1][b - 'A']++;
}
for (int i = 0; i < 5; i++)
{
for (int j = 0; j < 3; j++)
{
if(jest[i][j] < (i == 4 ? 2 : 1))
{
cout << "NIE" << endl;
exit(0);
}
}
}
cout << "TAK" << endl;
}
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 | #include <bits/stdc++.h> using namespace std; int n; int jest[5][3]; int main () { cin >> n; for (int i = 0; i < n; i++) { int a; char b; scanf("%d%c", &a, &b); jest[a - 1][b - 'A']++; } for (int i = 0; i < 5; i++) { for (int j = 0; j < 3; j++) { if(jest[i][j] < (i == 4 ? 2 : 1)) { cout << "NIE" << endl; exit(0); } } } cout << "TAK" << endl; } |
English