#include <bits/stdc++.h> using namespace std; int task_cnt[6][3]; // [][0]: A, [][1]: B, [][2]: C int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int n; cin >> n; for (int i = 1; i <= n; ++i){ string a; cin >> a; int round = a[0]-'0'; int div = a[1]-'A'; task_cnt[round][div]++; } bool possible = true; for (int i = 1; i <= 5; ++i) for (int j = 0; j < 3; ++j){ //cout << i << ", " << j << ": " << task_cnt[i][j] << "\n"; if (task_cnt[i][j] < 1 + (i==5) ) possible = false; } cout << (possible ? "TAK\n" : "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 | #include <bits/stdc++.h> using namespace std; int task_cnt[6][3]; // [][0]: A, [][1]: B, [][2]: C int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int n; cin >> n; for (int i = 1; i <= n; ++i){ string a; cin >> a; int round = a[0]-'0'; int div = a[1]-'A'; task_cnt[round][div]++; } bool possible = true; for (int i = 1; i <= 5; ++i) for (int j = 0; j < 3; ++j){ //cout << i << ", " << j << ": " << task_cnt[i][j] << "\n"; if (task_cnt[i][j] < 1 + (i==5) ) possible = false; } cout << (possible ? "TAK\n" : "NIE\n"); } |