#include <iostream> #include <map> using namespace std; int main(){ map<char, map<int, int>> m; map<int, int> m1; for(int i = 1; i <= 5; i++){ m1[i] = 0; } m['A'] = m1; m['B'] = m1; m['C'] = m1; int n = 100; string input[100]; int counter = 0; char d; int num; cin >> n; for(int i = 0; i < n; i++){ cin >> input[i]; } for(int i = 0; i < n; i++){ num = (int)input[i][0] - '0'; d = input[i][1]; m[d][num] += 1; if((num < 5 && m[d][num] == 1) || (num == 5 && m[d][num] == 2)){ counter += 1; } } if(counter == 15){ cout << "TAK" << endl; }else{ cout << "NIE" << endl; } }
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 | #include <iostream> #include <map> using namespace std; int main(){ map<char, map<int, int>> m; map<int, int> m1; for(int i = 1; i <= 5; i++){ m1[i] = 0; } m['A'] = m1; m['B'] = m1; m['C'] = m1; int n = 100; string input[100]; int counter = 0; char d; int num; cin >> n; for(int i = 0; i < n; i++){ cin >> input[i]; } for(int i = 0; i < n; i++){ num = (int)input[i][0] - '0'; d = input[i][1]; m[d][num] += 1; if((num < 5 && m[d][num] == 1) || (num == 5 && m[d][num] == 2)){ counter += 1; } } if(counter == 15){ cout << "TAK" << endl; }else{ cout << "NIE" << endl; } } |