#include <iostream>
using namespace std;
int main()
{
//std::ios_base::sync_with_stdio(false);
//std::cin.tie(NULL);
int n, suma = 0, A[6][3];
for (int i = 1; i <= 5; i++)
for (int j = 0; j < 3; j++)
A[i][j] = 0;
cin>>n;
string zad;
int d, r;
for (int i = 0; i < n; i++){
cin>>zad;
r = (int)zad[0] - '0';
d = zad[1] - 'A';
A[r][d]++;
if ((r == 5 && A[r][d] == 2) || (r != 5 && A[r][d] == 1))
suma++;
if (suma == 15){
cout<< "TAK"<<endl;
return 0;
}
}
cout<<"NIE"<<endl;
}
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 <iostream> using namespace std; int main() { //std::ios_base::sync_with_stdio(false); //std::cin.tie(NULL); int n, suma = 0, A[6][3]; for (int i = 1; i <= 5; i++) for (int j = 0; j < 3; j++) A[i][j] = 0; cin>>n; string zad; int d, r; for (int i = 0; i < n; i++){ cin>>zad; r = (int)zad[0] - '0'; d = zad[1] - 'A'; A[r][d]++; if ((r == 5 && A[r][d] == 2) || (r != 5 && A[r][d] == 1)) suma++; if (suma == 15){ cout<< "TAK"<<endl; return 0; } } cout<<"NIE"<<endl; } |
English