#include<bits/stdc++.h>
using namespace std;
multiset <string> s;
int main()
{
ios_base::sync_with_stdio(false);
int n; cin >> n;
while(n--)
{
string x; cin >> x;
s.insert(x);
}
bool czy = true;
for(char i = '1'; i <= '5'; i++)
{
for(char j = 'A'; j <= 'C'; j++)
{
string x;
x += i; x += j;
int a = i < '5' ? 1 : 2;
if(s.count(x) < a) czy = false;
}
}
czy ? cout << "TAK" : 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 | #include<bits/stdc++.h> using namespace std; multiset <string> s; int main() { ios_base::sync_with_stdio(false); int n; cin >> n; while(n--) { string x; cin >> x; s.insert(x); } bool czy = true; for(char i = '1'; i <= '5'; i++) { for(char j = 'A'; j <= 'C'; j++) { string x; x += i; x += j; int a = i < '5' ? 1 : 2; if(s.count(x) < a) czy = false; } } czy ? cout << "TAK" : cout << "NIE"; return 0; } |
English