#include <iostream>
#include <string>
using namespace std;
bool czyWlasciwyZestaw(bool a[6])
{
for (int i = 0; i < 6; i++)
{
if (!a[i]) return false;
}
return true;
}
int main()
{
int t, n;
string s;
bool a[6] = {};
bool b[6] = {};
bool c[6] = {};
cin >> t;
for (int i = 0; i < t; i++)
{
cin >> s;
n = s[0] - '0';
switch (s[1])
{
case 'A':
if (n == 5 && a[4]) n++;
a[n - 1] = true;
break;
case 'B':
if (n == 5 && b[4]) n++;
b[n - 1] = true;
break;
case 'C':
if (n == 5 && c[4]) n++;
c[n - 1] = true;
break;
}
}
if (czyWlasciwyZestaw(a) && czyWlasciwyZestaw(b) && czyWlasciwyZestaw(c)) cout << "TAK";
else cout << "NIE";
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 42 43 44 45 46 47 48 49 50 51 52 53 | #include <iostream> #include <string> using namespace std; bool czyWlasciwyZestaw(bool a[6]) { for (int i = 0; i < 6; i++) { if (!a[i]) return false; } return true; } int main() { int t, n; string s; bool a[6] = {}; bool b[6] = {}; bool c[6] = {}; cin >> t; for (int i = 0; i < t; i++) { cin >> s; n = s[0] - '0'; switch (s[1]) { case 'A': if (n == 5 && a[4]) n++; a[n - 1] = true; break; case 'B': if (n == 5 && b[4]) n++; b[n - 1] = true; break; case 'C': if (n == 5 && c[4]) n++; c[n - 1] = true; break; } } if (czyWlasciwyZestaw(a) && czyWlasciwyZestaw(b) && czyWlasciwyZestaw(c)) cout << "TAK"; else cout << "NIE"; return 0; } |
English