#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int n,tab[5][3];
bool czy=1;
int runda(string str){
return str[0]-49;
}
int dywizjon(string str){
return str[1]-65;
}
int main (){
cin>>n;
if (n<18)
czy=0;
string s[n];
for ( int i=0; i<n; i++){
cin>>s[i];
//cout<<runda(s[i])<<" "<<dywizjon(s[i])<<"; ";
tab[runda(s[i])][dywizjon(s[i])]++;
}
for ( int i=0; i<5; i++){
for ( int j=0; j<3; j++){
if (i==4 && tab[i][j]<2){
czy=0;
}
else if (tab[i][j]<1){
czy=0;
}
}
}
if (czy)
cout<<"TAK";
else
cout<<"NIE";
}
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 <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include <string> using namespace std; int n,tab[5][3]; bool czy=1; int runda(string str){ return str[0]-49; } int dywizjon(string str){ return str[1]-65; } int main (){ cin>>n; if (n<18) czy=0; string s[n]; for ( int i=0; i<n; i++){ cin>>s[i]; //cout<<runda(s[i])<<" "<<dywizjon(s[i])<<"; "; tab[runda(s[i])][dywizjon(s[i])]++; } for ( int i=0; i<5; i++){ for ( int j=0; j<3; j++){ if (i==4 && tab[i][j]<2){ czy=0; } else if (tab[i][j]<1){ czy=0; } } } if (czy) cout<<"TAK"; else cout<<"NIE"; } |
English