#include <iostream> int main() { std::iostream::sync_with_stdio(0); int n; std::string buf; int dayCount[15]; bool result = true; std::cin >> n; if(n < 18) { result = false; } else { for(int i = 0; i < 15; ++i) { dayCount[i] = 0; } for(int i = 0; i < n; ++i) { std::cin >> buf; int index = (buf[0] - '1') * 3 + buf[1] - 'A'; ++dayCount[index]; } for(int i = 0; i < 15; ++i) { if(dayCount[i] < 1 + (i >= 12)) { result = false; } } } if(result) { std::cout << "TAK"; } else { std::cout << "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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | #include <iostream> int main() { std::iostream::sync_with_stdio(0); int n; std::string buf; int dayCount[15]; bool result = true; std::cin >> n; if(n < 18) { result = false; } else { for(int i = 0; i < 15; ++i) { dayCount[i] = 0; } for(int i = 0; i < n; ++i) { std::cin >> buf; int index = (buf[0] - '1') * 3 + buf[1] - 'A'; ++dayCount[index]; } for(int i = 0; i < 15; ++i) { if(dayCount[i] < 1 + (i >= 12)) { result = false; } } } if(result) { std::cout << "TAK"; } else { std::cout << "NIE"; } return 0; } |