#include <iostream>
#include <string>
#include <bitset>
#include <unordered_map>
int main()
{
std::unordered_map<std::string, int> zad;
int n;
std::cin >> n;
std::string tmp;
for(int i=0; i<n; ++i)
{
std::cin >> tmp;
zad[tmp]++;
}
std::string a{"5A"}, b{"5B"}, c{"5C"};
if (zad.size() == 15)
{
int a_v = zad[a], b_v = zad[b], c_v = zad[c];
if (a_v >= 2 && b_v >= 2 && c_v >= 2)
{
std::cout << "TAK" << std::endl;
return 0;
}
}
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 <string> #include <bitset> #include <unordered_map> int main() { std::unordered_map<std::string, int> zad; int n; std::cin >> n; std::string tmp; for(int i=0; i<n; ++i) { std::cin >> tmp; zad[tmp]++; } std::string a{"5A"}, b{"5B"}, c{"5C"}; if (zad.size() == 15) { int a_v = zad[a], b_v = zad[b], c_v = zad[c]; if (a_v >= 2 && b_v >= 2 && c_v >= 2) { std::cout << "TAK" << std::endl; return 0; } } std::cout << "NIE" << std::endl; return 0; } |
English