#include <iostream> #include <string.h> int main(void) { int pomysly = 0; std::cin >> pomysly; int tab[5][3] = {0}; std::string hand = ""; int counter = 0; for (size_t i = 0; i < pomysly; i++) { std::cin >> hand; if (hand == "1A") { tab[0][0] += 1; } else if (hand == "1B") { tab[0][1] += 1; } else if (hand == "1C") { tab[0][2] += 1; } else if (hand == "2A") { tab[1][0] += 1; } else if (hand == "2B") { tab[1][1] += 1; } else if (hand == "2C") { tab[1][2] += 1; } else if (hand == "3A") { tab[2][0] += 1; } else if (hand == "3B") { tab[2][1] += 1; } else if (hand == "3C") { tab[2][2] += 1; } else if (hand == "4A") { tab[3][0] += 1; } else if (hand == "4B") { tab[3][1] += 1; } else if (hand == "4C") { tab[3][2] += 1; } else if (hand == "5A") { tab[4][0] += 1; } else if (hand == "5B") { tab[4][1] += 1; } else if (hand == "5C") { tab[4][2] += 1; } } for (size_t i = 0; i <= 3; i++) { for (size_t j = 0; j < 3; j++) { if (tab[i][j] < 1) { counter++; } } } for (size_t i = 0; i < 3; i++) { if (tab[4][i] < 2) { counter++; } } if (counter == 0) { std::cout << "TAK" << '\n'; } else if (counter > 0){ std::cout << "NIE" << '\n'; } 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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | #include <iostream> #include <string.h> int main(void) { int pomysly = 0; std::cin >> pomysly; int tab[5][3] = {0}; std::string hand = ""; int counter = 0; for (size_t i = 0; i < pomysly; i++) { std::cin >> hand; if (hand == "1A") { tab[0][0] += 1; } else if (hand == "1B") { tab[0][1] += 1; } else if (hand == "1C") { tab[0][2] += 1; } else if (hand == "2A") { tab[1][0] += 1; } else if (hand == "2B") { tab[1][1] += 1; } else if (hand == "2C") { tab[1][2] += 1; } else if (hand == "3A") { tab[2][0] += 1; } else if (hand == "3B") { tab[2][1] += 1; } else if (hand == "3C") { tab[2][2] += 1; } else if (hand == "4A") { tab[3][0] += 1; } else if (hand == "4B") { tab[3][1] += 1; } else if (hand == "4C") { tab[3][2] += 1; } else if (hand == "5A") { tab[4][0] += 1; } else if (hand == "5B") { tab[4][1] += 1; } else if (hand == "5C") { tab[4][2] += 1; } } for (size_t i = 0; i <= 3; i++) { for (size_t j = 0; j < 3; j++) { if (tab[i][j] < 1) { counter++; } } } for (size_t i = 0; i < 3; i++) { if (tab[4][i] < 2) { counter++; } } if (counter == 0) { std::cout << "TAK" << '\n'; } else if (counter > 0){ std::cout << "NIE" << '\n'; } return 0; } |