#include <cstdio> #include <iostream> #include <string> #include <map> using namespace std; int main() { int n; string tasksNames[] = {"1A", "1B", "1C", "2A", "2B", "2C", "3A", "3B", "3C", "4A", "4B", "4C", "5A", "5B", "5C" }; int tasksCount[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; int arrayLen = 15; map<string, int> mymap; for (int i=0; i<arrayLen;i++) mymap[tasksNames[i]] = 0; string s; cin >> n; for (int i=0; i<n; i++) { cin >> s; mymap[s]++; } for (int i=0; i<arrayLen;i++) { if (mymap[tasksNames[i]] < tasksCount[i]) { cout << "NIE\n"; return 0; } } cout << "TAK\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 | #include <cstdio> #include <iostream> #include <string> #include <map> using namespace std; int main() { int n; string tasksNames[] = {"1A", "1B", "1C", "2A", "2B", "2C", "3A", "3B", "3C", "4A", "4B", "4C", "5A", "5B", "5C" }; int tasksCount[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2 }; int arrayLen = 15; map<string, int> mymap; for (int i=0; i<arrayLen;i++) mymap[tasksNames[i]] = 0; string s; cin >> n; for (int i=0; i<n; i++) { cin >> s; mymap[s]++; } for (int i=0; i<arrayLen;i++) { if (mymap[tasksNames[i]] < tasksCount[i]) { cout << "NIE\n"; return 0; } } cout << "TAK\n"; } |