#include <iostream> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int* rounds = new int[15]; int i, n; string a; int sum = 15; for (i = 0; i < 15; i++) { rounds[i] = 1; } rounds[4] = 2; rounds[9] = 2; rounds[14] = 2; cin >> n; while (n--) { cin >> a; i = (a[0] - '0') - 1; i += 5 * (a[1] == 'A' ? 0 : (a[1] == 'B' ? 1 : 2)); rounds[i]--; if (rounds[i] == 0) { sum--; } } cout << (sum == 0 ? "TAK" : "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 | #include <iostream> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int* rounds = new int[15]; int i, n; string a; int sum = 15; for (i = 0; i < 15; i++) { rounds[i] = 1; } rounds[4] = 2; rounds[9] = 2; rounds[14] = 2; cin >> n; while (n--) { cin >> a; i = (a[0] - '0') - 1; i += 5 * (a[1] == 'A' ? 0 : (a[1] == 'B' ? 1 : 2)); rounds[i]--; if (rounds[i] == 0) { sum--; } } cout << (sum == 0 ? "TAK" : "NIE") << '\n'; } |