#include <iostream>
using namespace std;
int zestaw[5][3];
int main() {
ios_base::sync_with_stdio(0);
int n;
cin >> n;
while (n--) {
string poz;
cin >> poz;
int r = poz[0]-49;
int d = poz[1]-65;
if (r<4) {
if (zestaw[r][d]<1)
zestaw[r][d]++;
} else
if (zestaw[r][d]<2)
zestaw[r][d]++;
}
int suma=0;
for (int r=0;r<5;r++)
for (int d=0;d<3;d++)
suma+=zestaw[r][d];
cout << (suma==18 ? "TAK" : "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 | #include <iostream> using namespace std; int zestaw[5][3]; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; while (n--) { string poz; cin >> poz; int r = poz[0]-49; int d = poz[1]-65; if (r<4) { if (zestaw[r][d]<1) zestaw[r][d]++; } else if (zestaw[r][d]<2) zestaw[r][d]++; } int suma=0; for (int r=0;r<5;r++) for (int d=0;d<3;d++) suma+=zestaw[r][d]; cout << (suma==18 ? "TAK" : "NIE"); return 0; } |
English