#include <iostream>
#include <unordered_map>
using namespace std;
int main() {
unordered_map<string, int> howMany;
char divs[] = {'A', 'B', 'C'};
for (char division : divs) {
for (int i = 1; i < 6; i++) {
howMany[to_string(i) + division] = 0;
}
}
int ideas;
string zad;
cin >> ideas;
if(ideas > 100 || ideas < 1) { return 0; }
for (int i = 0; i < ideas; i++) {
cin >> zad;
howMany[zad]++;
}
bool correctSet = true;
for (const auto& key : howMany) {
if (key.second == 0 || ((key.first == "5A" || key.first == "5B" || key.first == "5C") && key.second < 2)) {
correctSet = false;
}
}
correctSet ? cout << "TAK" : 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 | #include <iostream> #include <unordered_map> using namespace std; int main() { unordered_map<string, int> howMany; char divs[] = {'A', 'B', 'C'}; for (char division : divs) { for (int i = 1; i < 6; i++) { howMany[to_string(i) + division] = 0; } } int ideas; string zad; cin >> ideas; if(ideas > 100 || ideas < 1) { return 0; } for (int i = 0; i < ideas; i++) { cin >> zad; howMany[zad]++; } bool correctSet = true; for (const auto& key : howMany) { if (key.second == 0 || ((key.first == "5A" || key.first == "5B" || key.first == "5C") && key.second < 2)) { correctSet = false; } } correctSet ? cout << "TAK" : cout << "NIE"; return 0; } |
English