#include <iostream> #include <algorithm> #include <vector> using namespace std; int n; vector <string> v; int main(){ cin >> n; int tab[5][3] = {0}; string str; for(int i = 0; i < n; i++){ cin >> str; //cout << str[0] - '1' << " " << str[1] - 'A' << "\n"; tab[str[0] - '1'][str[1] - 'A']++; } for(int day = 0; day < 5; day++){ for(int zad = 0; zad < 3; zad++){ if(tab[day][zad] < 1 || (day == 4 && tab[day][zad] < 2)){ //cout << day << " " << zad; cout << "NIE"; return 0; } } } cout << "TAK"; 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 | #include <iostream> #include <algorithm> #include <vector> using namespace std; int n; vector <string> v; int main(){ cin >> n; int tab[5][3] = {0}; string str; for(int i = 0; i < n; i++){ cin >> str; //cout << str[0] - '1' << " " << str[1] - 'A' << "\n"; tab[str[0] - '1'][str[1] - 'A']++; } for(int day = 0; day < 5; day++){ for(int zad = 0; zad < 3; zad++){ if(tab[day][zad] < 1 || (day == 4 && tab[day][zad] < 2)){ //cout << day << " " << zad; cout << "NIE"; return 0; } } } cout << "TAK"; return 0; } |