#include <iostream> #include <vector> #include <string> int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0); std::vector<std::vector<int>> v(5, std::vector<int>(3)); int counter = 0; int n; std::cin >> n; for (int i = 0; i < n; ++i) { std::string s; std::cin >> s; ++v[s[0] - '1'][s[1] - 'A']; if (s[0] == '5') { if (v[s[0] - '1'][s[1] - 'A'] == 2) ++counter; } else if (v[s[0] - '1'][s[1] - 'A'] == 1) ++counter; } if (counter == 15) std::cout << "TAK" << std::endl; else std::cout << "NIE" << std::endl; 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 | #include <iostream> #include <vector> #include <string> int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0); std::vector<std::vector<int>> v(5, std::vector<int>(3)); int counter = 0; int n; std::cin >> n; for (int i = 0; i < n; ++i) { std::string s; std::cin >> s; ++v[s[0] - '1'][s[1] - 'A']; if (s[0] == '5') { if (v[s[0] - '1'][s[1] - 'A'] == 2) ++counter; } else if (v[s[0] - '1'][s[1] - 'A'] == 1) ++counter; } if (counter == 15) std::cout << "TAK" << std::endl; else std::cout << "NIE" << std::endl; return 0; } |