#include <iostream> using namespace std; const int MAX_G = 3; const int MAX_D = 5; int zadania[MAX_G][MAX_D] = { {-1,-1,-1,-1,-2}, {-1,-1,-1,-1,-2}, {-1,-1,-1,-1,-2}, }; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int N; cin >> N; if (N < 18) { cout << "NIE"; return 0; } string zadanie; int G, D; for (int i = 0; i < N; i++) { cin >> zadanie; G = (int)(zadanie[1] - 65); D = (int)(zadanie[0] - 49); zadania[G][D]++; }; for (int i = 0; i < MAX_G; i++) for (int j = 0; j < MAX_D; j++) if (zadania[i][j] < 0) { cout << "NIE"; return 0; } 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 42 43 44 45 46 47 48 49 | #include <iostream> using namespace std; const int MAX_G = 3; const int MAX_D = 5; int zadania[MAX_G][MAX_D] = { {-1,-1,-1,-1,-2}, {-1,-1,-1,-1,-2}, {-1,-1,-1,-1,-2}, }; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int N; cin >> N; if (N < 18) { cout << "NIE"; return 0; } string zadanie; int G, D; for (int i = 0; i < N; i++) { cin >> zadanie; G = (int)(zadanie[1] - 65); D = (int)(zadanie[0] - 49); zadania[G][D]++; }; for (int i = 0; i < MAX_G; i++) for (int j = 0; j < MAX_D; j++) if (zadania[i][j] < 0) { cout << "NIE"; return 0; } cout << "TAK"; return 0; } |