#include <iostream>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
int testowy(vector<char> a, vector<char> b, vector<char> c, char q)
{
int p = 1;
if(q == '5') p = 2;
if(count(a.begin(), a.end(), q) >= p && count(b.begin(), b.end(), q) >= p && count(c.begin(), c.end(), q) >= p)
{
return 1;
}
else
{
return 0;
}
}
int main()
{
int n;
string x;
cin>>n;
int wynik;
string tab[n];
std::vector<char> a,b,c;
for(int i = 0; i < n; i++)
{
cin>>x;
switch(x[1])
{
case 'A':
a.push_back(x[0]);
break;
case 'B':
b.push_back(x[0]);
break;
case 'C':
c.push_back(x[0]);
break;
}
}
if(n<18)
{
cout<<"NIE";
return 0;
}
wynik = testowy(a,b,c,'1') + testowy(a,b,c,'2') + testowy(a,b,c,'3') + testowy(a,b,c,'4') + testowy(a,b,c,'5');
if(wynik == 5)
cout<<"TAK";
else
cout<<"NIE";
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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | #include <iostream> #include <vector> #include <bits/stdc++.h> using namespace std; int testowy(vector<char> a, vector<char> b, vector<char> c, char q) { int p = 1; if(q == '5') p = 2; if(count(a.begin(), a.end(), q) >= p && count(b.begin(), b.end(), q) >= p && count(c.begin(), c.end(), q) >= p) { return 1; } else { return 0; } } int main() { int n; string x; cin>>n; int wynik; string tab[n]; std::vector<char> a,b,c; for(int i = 0; i < n; i++) { cin>>x; switch(x[1]) { case 'A': a.push_back(x[0]); break; case 'B': b.push_back(x[0]); break; case 'C': c.push_back(x[0]); break; } } if(n<18) { cout<<"NIE"; return 0; } wynik = testowy(a,b,c,'1') + testowy(a,b,c,'2') + testowy(a,b,c,'3') + testowy(a,b,c,'4') + testowy(a,b,c,'5'); if(wynik == 5) cout<<"TAK"; else cout<<"NIE"; return 0; } |
English