#include <iostream> #include <math.h> #include <stdio.h> #include <string> #include <map> #include <stdlib.h> #include <vector> using namespace std; int main() { int zad; scanf("%d", &zad); std::map<std::string, int> expected = { {"1A",1}, {"1B",1}, {"1C",1}, {"2A",1}, {"2B",1}, {"2C",1}, {"3A",1}, {"3B",1}, {"3C",1}, {"4A",1}, {"4B",1}, {"4C",1}, {"5A",2}, {"5B",2}, {"5C",2}, }; for (int i = 0 ; i < zad; i++) { char tmp[101]; scanf("%s", tmp); string str = tmp; if ( expected.find(str) != expected.end() ) { int current = expected[str]; current--; expected[str] = current; } } map<string, int>::iterator it; bool isOk = true; for ( it = expected.begin(); it != expected.end(); it++ ) { if(it->second > 0) { isOk = false; } } if (isOk) { printf("TAK"); } else { printf("NIE"); } }
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #include <iostream> #include <math.h> #include <stdio.h> #include <string> #include <map> #include <stdlib.h> #include <vector> using namespace std; int main() { int zad; scanf("%d", &zad); std::map<std::string, int> expected = { {"1A",1}, {"1B",1}, {"1C",1}, {"2A",1}, {"2B",1}, {"2C",1}, {"3A",1}, {"3B",1}, {"3C",1}, {"4A",1}, {"4B",1}, {"4C",1}, {"5A",2}, {"5B",2}, {"5C",2}, }; for (int i = 0 ; i < zad; i++) { char tmp[101]; scanf("%s", tmp); string str = tmp; if ( expected.find(str) != expected.end() ) { int current = expected[str]; current--; expected[str] = current; } } map<string, int>::iterator it; bool isOk = true; for ( it = expected.begin(); it != expected.end(); it++ ) { if(it->second > 0) { isOk = false; } } if (isOk) { printf("TAK"); } else { printf("NIE"); } } |