#include <iostream> #include <vector> using namespace std; int main(){ int n; cin >> n; vector<vector<int>> Q(5, vector<int>(3)); while(n--){ string g; cin >> g; if(g[1] == 'A'){ Q[g[0] - '0' - 1][0]++; } else if(g[1] == 'B'){ Q[g[0] - '0' - 1][1]++; } else { Q[g[0] - '0' - 1][2]++; } } bool flag = true; for(int i = 0; i < 4; i++){ if(Q[i][0] < 1 || Q[i][1] < 1 || Q[i][2] < 1){ flag = false; } } if(Q[4][0] < 2 || Q[4][1] < 2 || Q[4][2] < 2){ flag = false; } if(flag){ 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 40 41 | #include <iostream> #include <vector> using namespace std; int main(){ int n; cin >> n; vector<vector<int>> Q(5, vector<int>(3)); while(n--){ string g; cin >> g; if(g[1] == 'A'){ Q[g[0] - '0' - 1][0]++; } else if(g[1] == 'B'){ Q[g[0] - '0' - 1][1]++; } else { Q[g[0] - '0' - 1][2]++; } } bool flag = true; for(int i = 0; i < 4; i++){ if(Q[i][0] < 1 || Q[i][1] < 1 || Q[i][2] < 1){ flag = false; } } if(Q[4][0] < 2 || Q[4][1] < 2 || Q[4][2] < 2){ flag = false; } if(flag){ cout << "TAK\n"; } else { cout << "NIE\n"; } } |