#include <iostream>
#include <set>
#include <string>
using namespace std;
int main() {
multiset<string> set = multiset<string>();
for(char i = '1'; i <= '5'; i++) {
for(char j = 'A'; j <= 'C'; j++) {
string s;
s += i;
s += j;
set.insert(s);
}
}
set.insert("5A");
set.insert("5B");
set.insert("5C");
int n;
cin >> n;
string str;
for(int i = 0; i < n; i++) {
cin >> str;
const multiset<string>::iterator &iterator = set.find(str);
if(iterator != set.end()) {
set.erase(iterator);
}
}
cout << (set.empty() ? "TAK" : "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 36 37 | #include <iostream> #include <set> #include <string> using namespace std; int main() { multiset<string> set = multiset<string>(); for(char i = '1'; i <= '5'; i++) { for(char j = 'A'; j <= 'C'; j++) { string s; s += i; s += j; set.insert(s); } } set.insert("5A"); set.insert("5B"); set.insert("5C"); int n; cin >> n; string str; for(int i = 0; i < n; i++) { cin >> str; const multiset<string>::iterator &iterator = set.find(str); if(iterator != set.end()) { set.erase(iterator); } } cout << (set.empty() ? "TAK" : "NIE") << endl; return 0; } |
English