#include<iostream>
#include<string>
using namespace std;
int t[5],t2[5],t3[5];
int b,n;
string wynik;
string a;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n;
for(int i=0;i<n;i++){
cin>>a;
b=(int)a[0]-(int)'0';
if(a[1]=='A'){
t[b-1]++;
}
else if(a[1]=='B'){
t2[b-1]++;
}
else {
t3[b-1]++;
}
}
wynik="TAK";
for(int i=0;i<5;i++){
if(t[i]<1||t2[i]<1||t3[i]<1){
wynik="NIE";
}
}
if(t[4]<2||t2[4]<2||t3[4]<2){
wynik="NIE";
}
cout<<wynik;
}
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 | #include<iostream> #include<string> using namespace std; int t[5],t2[5],t3[5]; int b,n; string wynik; string a; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n; for(int i=0;i<n;i++){ cin>>a; b=(int)a[0]-(int)'0'; if(a[1]=='A'){ t[b-1]++; } else if(a[1]=='B'){ t2[b-1]++; } else { t3[b-1]++; } } wynik="TAK"; for(int i=0;i<5;i++){ if(t[i]<1||t2[i]<1||t3[i]<1){ wynik="NIE"; } } if(t[4]<2||t2[4]<2||t3[4]<2){ wynik="NIE"; } cout<<wynik; } |
English