#include <iostream>
using namespace std;
int lic (char z)
{
switch(z)
{
case '1':
return 1;
break;
case '2':
return 2;
break;
case '3':
return 3;
break;
case '4':
return 4;
break;
case '5':
return 5;
break;
}
}
int n, m,ma=1,st,en,ko,wynik;
string zad;
int tab[5][3];
int main()
{
cin >> n;
for (int i=0;i<n;i++)
{
cin >> zad ;
if ( zad[1]== 'A')
{
tab [lic(zad[0])-1][0]++;
}
else if (zad[1] == 'B')
{
tab [lic(zad[0])-1][1]++;
}
else if( zad [1]=='C')
{
tab [lic(zad[0])-1][2]++;
}
}
for(int i=0;i<4;i++)
for (int u=0;u< 3;u++)
if (tab[i][u] < 1)
{
ma=0;
}
for (int i=0;i<3;i++)
if(tab[4][i]<2)
ma=0;
if ( ma == 0)
cout << "NIE";
else
cout << "TAK";
}
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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | #include <iostream> using namespace std; int lic (char z) { switch(z) { case '1': return 1; break; case '2': return 2; break; case '3': return 3; break; case '4': return 4; break; case '5': return 5; break; } } int n, m,ma=1,st,en,ko,wynik; string zad; int tab[5][3]; int main() { cin >> n; for (int i=0;i<n;i++) { cin >> zad ; if ( zad[1]== 'A') { tab [lic(zad[0])-1][0]++; } else if (zad[1] == 'B') { tab [lic(zad[0])-1][1]++; } else if( zad [1]=='C') { tab [lic(zad[0])-1][2]++; } } for(int i=0;i<4;i++) for (int u=0;u< 3;u++) if (tab[i][u] < 1) { ma=0; } for (int i=0;i<3;i++) if(tab[4][i]<2) ma=0; if ( ma == 0) cout << "NIE"; else cout << "TAK"; } |
English