#include <iostream>
#include <string>
using namespace std;
int main()
{
int t;
string napis;
int tab[7][5] = {};
bool flag = 0;
cin >> t;
for (int i = 0; i < t; i++)
{
cin >> napis;
int x = napis[0] - '0';
if (napis[1] == 'A')
tab[x][1]++;
else if (napis[1] == 'B')
tab[x][2]++;
else
tab[x][3]++;
}
for (int x = 1; x < 5; x++)
{
for (int y = 1; y < 4; y++)
{
if (tab[x][y] == 0)
{
flag = 1;
break;
}
}
}
if (tab[5][1] < 2) flag = 1;
if (tab[5][2] < 2) flag = 1;
if (tab[5][3] < 2) flag = 1;
if (flag == 1) cout << "NIE";
else cout << "TAK";
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 | #include <iostream> #include <string> using namespace std; int main() { int t; string napis; int tab[7][5] = {}; bool flag = 0; cin >> t; for (int i = 0; i < t; i++) { cin >> napis; int x = napis[0] - '0'; if (napis[1] == 'A') tab[x][1]++; else if (napis[1] == 'B') tab[x][2]++; else tab[x][3]++; } for (int x = 1; x < 5; x++) { for (int y = 1; y < 4; y++) { if (tab[x][y] == 0) { flag = 1; break; } } } if (tab[5][1] < 2) flag = 1; if (tab[5][2] < 2) flag = 1; if (tab[5][3] < 2) flag = 1; if (flag == 1) cout << "NIE"; else cout << "TAK"; return 0; } |
English