#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int tab[17];
for(int i=0; i<17; ++i){
tab[i] = 0;
}
for(int i=0; i<n; ++i){
string temp;
cin >> temp;
if(temp=="1A") {tab[0]++;}
else if(temp=="1B"){tab[1]++;}
else if(temp=="1C"){tab[2]++ ;}
else if(temp=="2A"){tab[3]++ ;}
else if(temp=="2B"){tab[4]++ ;}
else if(temp=="2C"){tab[5]++ ;}
else if(temp=="3A"){tab[6]++ ;}
else if(temp=="3B"){tab[7]++ ;}
else if(temp=="3C"){tab[8]++ ;}
else if(temp=="4A"){tab[9]++ ;}
else if(temp=="4B"){tab[10]++ ;}
else if(temp=="4C"){tab[11]++ ;}
else if(temp=="5A"){tab[12]++ ;}
else if(temp=="5B"){tab[13]++ ;}
else if(temp=="5C"){tab[14]++ ;}
}
bool is_good = true;
for(int i=0; i<12; ++i){
if(tab[i]<=0){
is_good = false;
}
}
for(int i=12; i<15; ++i){
if(tab[i]<=1){
is_good = false;
}
}
if(is_good){
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 | #include <iostream> using namespace std; int main() { int n; cin >> n; int tab[17]; for(int i=0; i<17; ++i){ tab[i] = 0; } for(int i=0; i<n; ++i){ string temp; cin >> temp; if(temp=="1A") {tab[0]++;} else if(temp=="1B"){tab[1]++;} else if(temp=="1C"){tab[2]++ ;} else if(temp=="2A"){tab[3]++ ;} else if(temp=="2B"){tab[4]++ ;} else if(temp=="2C"){tab[5]++ ;} else if(temp=="3A"){tab[6]++ ;} else if(temp=="3B"){tab[7]++ ;} else if(temp=="3C"){tab[8]++ ;} else if(temp=="4A"){tab[9]++ ;} else if(temp=="4B"){tab[10]++ ;} else if(temp=="4C"){tab[11]++ ;} else if(temp=="5A"){tab[12]++ ;} else if(temp=="5B"){tab[13]++ ;} else if(temp=="5C"){tab[14]++ ;} } bool is_good = true; for(int i=0; i<12; ++i){ if(tab[i]<=0){ is_good = false; } } for(int i=12; i<15; ++i){ if(tab[i]<=1){ is_good = false; } } if(is_good){ cout << "TAK"; }else{ cout << "NIE"; } return 0; } |
English