#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
int main() {
const auto X = {1, 2, 3, 4, 5};
const auto Y = {"A", "B", "C"};
int n;
string in;
map<string, int> m;
cin >> n;
while(n--)
cin >> in, m[in]++;
for (const auto& x : X)
for (const auto& y : Y)
if (m[to_string(x) + y] < 1)
{
cout << "NIE";
return 0;
}
if (m["5A"] < 2 || m["5B"] < 2 || m["5C"] < 2)
{
cout << "NIE";
return 0;
}
cout << "TAK";
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 <map> #include <string> #include <vector> using namespace std; int main() { const auto X = {1, 2, 3, 4, 5}; const auto Y = {"A", "B", "C"}; int n; string in; map<string, int> m; cin >> n; while(n--) cin >> in, m[in]++; for (const auto& x : X) for (const auto& y : Y) if (m[to_string(x) + y] < 1) { cout << "NIE"; return 0; } if (m["5A"] < 2 || m["5B"] < 2 || m["5C"] < 2) { cout << "NIE"; return 0; } cout << "TAK"; return 0; } |
English