#include<bits/stdc++.h> #include<map> using namespace std; int main(){ int n; cin >> n; map<string, int> tasks; while(n--){ string task; cin >> task; if(tasks.find(task) == tasks.end()){ tasks[task] = 0; } tasks[task] += 1; } string neededOneTaskKeys [] = {"1A", "2A", "3A", "4A", "1B", "2B", "3B", "4B", "1C", "2C", "3C", "4C"}; string neededTwoTaskKeys [] = {"5A", "5B", "5C"}; bool result = true; for(int i=0; i<12; i++){ if(tasks[neededOneTaskKeys[i]] < 1){ result = false; break; } } for(int i=0; i<3; i++){ if(tasks[neededTwoTaskKeys[i]] < 2){ result = false; break; } } if(result){ cout << "TAK\n"; } else { cout << "NIE\n"; } }
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 | #include<bits/stdc++.h> #include<map> using namespace std; int main(){ int n; cin >> n; map<string, int> tasks; while(n--){ string task; cin >> task; if(tasks.find(task) == tasks.end()){ tasks[task] = 0; } tasks[task] += 1; } string neededOneTaskKeys [] = {"1A", "2A", "3A", "4A", "1B", "2B", "3B", "4B", "1C", "2C", "3C", "4C"}; string neededTwoTaskKeys [] = {"5A", "5B", "5C"}; bool result = true; for(int i=0; i<12; i++){ if(tasks[neededOneTaskKeys[i]] < 1){ result = false; break; } } for(int i=0; i<3; i++){ if(tasks[neededTwoTaskKeys[i]] < 2){ result = false; break; } } if(result){ cout << "TAK\n"; } else { cout << "NIE\n"; } } |