#include <iostream> #include <cstdio> #include <map> #include <cmath> #include <cstring> #include <vector> #include <set> #include <algorithm> using namespace std; int main(){ int n; int a5=0, b5=0, c5=0; string s; cin>>n; vector<string> v; while(n--){ cin>>s; if(s=="5A")a5++; if(s=="5B")b5++; if(s=="5C")c5++; v.push_back(s); } sort(v.begin(), v.end()); auto last = std::unique(v.begin(), v.end()); v.erase(last, v.end()); if(v.size() == 15 && a5>1 && b5>1 && c5>1){ cout<<"TAK"<<endl; }else{ cout<<"NIE"<<endl; } 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 | #include <iostream> #include <cstdio> #include <map> #include <cmath> #include <cstring> #include <vector> #include <set> #include <algorithm> using namespace std; int main(){ int n; int a5=0, b5=0, c5=0; string s; cin>>n; vector<string> v; while(n--){ cin>>s; if(s=="5A")a5++; if(s=="5B")b5++; if(s=="5C")c5++; v.push_back(s); } sort(v.begin(), v.end()); auto last = std::unique(v.begin(), v.end()); v.erase(last, v.end()); if(v.size() == 15 && a5>1 && b5>1 && c5>1){ cout<<"TAK"<<endl; }else{ cout<<"NIE"<<endl; } return 0; } |