#include <iostream> #include <vector> using namespace std; int main() { std::ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); vector<vector<int>> tab; tab.resize(3); for (int i = 0; i < 3; i++) tab[i].resize(5); int n; string b; cin >> n; for (int i = 0; i < n; i++) { cin >> b; int tempLet = b[1] - 65, tempInt = b[0]; tempInt -= '0'; tab[tempLet][tempInt - 1]++; } bool result = true; for (int i = 0; i < 3; i++) { for (int q = 0; q < 4; q++) { if (tab[i][q] == 0) result = false; } if(tab[i][4] < 2) result = false; } if(result) cout << "TAK" << "\n"; else cout << "NIE" << "\n"; }
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 | #include <iostream> #include <vector> using namespace std; int main() { std::ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); vector<vector<int>> tab; tab.resize(3); for (int i = 0; i < 3; i++) tab[i].resize(5); int n; string b; cin >> n; for (int i = 0; i < n; i++) { cin >> b; int tempLet = b[1] - 65, tempInt = b[0]; tempInt -= '0'; tab[tempLet][tempInt - 1]++; } bool result = true; for (int i = 0; i < 3; i++) { for (int q = 0; q < 4; q++) { if (tab[i][q] == 0) result = false; } if(tab[i][4] < 2) result = false; } if(result) cout << "TAK" << "\n"; else cout << "NIE" << "\n"; } |