//Jan Sosnowski #include<iostream> #include<bitset> #include<vector> using namespace std; vector < bitset<5> > s; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; char lit; if(n == 0){ /* cin >> lit; s.push_back(lit); while(lit != '\n' && lit != ' ' && s.size() < 13421743){ cin >> lit; s.push_back(lit); } if(s.size() < 13421743){ for(int i = 0; i< s.size()/2;i++){ if(s[i] != s[s.size()-1-i]){ cout << "nie"; return 0; } } cout << "tak"; } else{ cout << "nie"; } */ string sl; cin >> sl; cout << "NIE"; } else if(n-n%2 < 13421744){ for(int i = 0;i<n/2;i++){ cin >> lit; s.push_back(lit-'a'); // cout << s[i] << " "; } if(n%2 == 1) cin >> lit; for(int i = n/2-1; i >= 0;i--){ cin >> lit; if(s[i] != lit-'a'){ cout << "NIE"; return 0; } } cout << "TAK"; }else{ cout << "TAK"; } }
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | //Jan Sosnowski #include<iostream> #include<bitset> #include<vector> using namespace std; vector < bitset<5> > s; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; char lit; if(n == 0){ /* cin >> lit; s.push_back(lit); while(lit != '\n' && lit != ' ' && s.size() < 13421743){ cin >> lit; s.push_back(lit); } if(s.size() < 13421743){ for(int i = 0; i< s.size()/2;i++){ if(s[i] != s[s.size()-1-i]){ cout << "nie"; return 0; } } cout << "tak"; } else{ cout << "nie"; } */ string sl; cin >> sl; cout << "NIE"; } else if(n-n%2 < 13421744){ for(int i = 0;i<n/2;i++){ cin >> lit; s.push_back(lit-'a'); // cout << s[i] << " "; } if(n%2 == 1) cin >> lit; for(int i = n/2-1; i >= 0;i--){ cin >> lit; if(s[i] != lit-'a'){ cout << "NIE"; return 0; } } cout << "TAK"; }else{ cout << "TAK"; } } |