#include <iostream>
#include <string>
using namespace std;
int get_index(std::string s)
{
int a = s[0] - 49;
int b = s[1] - 65;
return a * 3 + b;
}
std::string check(int res[])
{
for(int i = 0;i < 12;++i)
if(res[i] < 1)
return "NIE";
for(int i = 12;i < 15;++i)
if(res[i] < 2)
return "NIE";
return "TAK";
}
int main()
{
int res[15] = {};
int n;
std::string s;
std::cin >> n;
for(int i = 0;i < n;++i)
{
std::cin >> s;
++res[get_index(s)];
}
std::cout << check(res);
}
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 | #include <iostream> #include <string> using namespace std; int get_index(std::string s) { int a = s[0] - 49; int b = s[1] - 65; return a * 3 + b; } std::string check(int res[]) { for(int i = 0;i < 12;++i) if(res[i] < 1) return "NIE"; for(int i = 12;i < 15;++i) if(res[i] < 2) return "NIE"; return "TAK"; } int main() { int res[15] = {}; int n; std::string s; std::cin >> n; for(int i = 0;i < n;++i) { std::cin >> s; ++res[get_index(s)]; } std::cout << check(res); } |
English