#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
int a[5] = {0, 0, 0, 0, 0};
int b[5] = {0, 0, 0, 0, 0};
int c[5] = {0, 0, 0, 0, 0};
for (int x=0; x<n; x++) {
string dane;
cin >> dane;
if (dane[1]=='A') {
a[dane[0]-49]++;
} else
if (dane[1]=='B') {
b[dane[0]-49]++;
} else
if (dane[1]=='C') {
c[dane[0]-49]++;
}
}
// cout << endl;
// cout << ('A'-49) << endl;
// cout << endl;
// for (int i=0; i<5; i++) cout << a[i] << ' ';
// cout << endl;
// for (int i=0; i<5; i++) cout << b[i] << ' ';
// cout << endl;
// for (int i=0; i<5; i++) cout << c[i] << ' ';
// cout << endl;
bool czy=true;
for (int i=0; i<4; i++) {
if (a[i]==0 || b[i]==0 || c[i]==0) czy=false;
}
if (a[4]<2 || b[4]<2 || c[4]<2) czy=false;
if (czy==true) {
cout << "TAK\n";
} else cout << "NIE\n";
return 0;
}
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 | #include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int a[5] = {0, 0, 0, 0, 0}; int b[5] = {0, 0, 0, 0, 0}; int c[5] = {0, 0, 0, 0, 0}; for (int x=0; x<n; x++) { string dane; cin >> dane; if (dane[1]=='A') { a[dane[0]-49]++; } else if (dane[1]=='B') { b[dane[0]-49]++; } else if (dane[1]=='C') { c[dane[0]-49]++; } } // cout << endl; // cout << ('A'-49) << endl; // cout << endl; // for (int i=0; i<5; i++) cout << a[i] << ' '; // cout << endl; // for (int i=0; i<5; i++) cout << b[i] << ' '; // cout << endl; // for (int i=0; i<5; i++) cout << c[i] << ' '; // cout << endl; bool czy=true; for (int i=0; i<4; i++) { if (a[i]==0 || b[i]==0 || c[i]==0) czy=false; } if (a[4]<2 || b[4]<2 || c[4]<2) czy=false; if (czy==true) { cout << "TAK\n"; } else cout << "NIE\n"; return 0; } |
English