Codeforces 691B s-palindrome
水题。
#pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<cstring> #include<cmath> #include<cstdlib> #include<algorithm> #include<vector> #include<map> #include<set> #include<queue> #include<stack> #include<iostream> using namespace std; typedef long long LL; const double pi = acos(-1.0), eps = 1e-8; void File() { freopen("D:\\in.txt", "r", stdin); freopen("D:\\out.txt", "w", stdout); } inline int read() { char c = getchar(); while (!isdigit(c)) c = getchar(); int x = 0; while (isdigit(c)) { x = x * 10 + c - '0'; c = getchar(); } return x; } char s[10000]; int f[1000][1000]; void init() { f['A']['A']=1; f['b']['d']=1; f['d']['b']=1; f['H']['H']=1; f['I']['I']=1; f['M']['M']=1; f['O']['O']=1; f['o']['o']=1; f['p']['q']=1; f['q']['p']=1; f['T']['T']=1; f['U']['U']=1; f['V']['V']=1; f['v']['v']=1; f['W']['W']=1; f['w']['w']=1; f['X']['X']=1; f['x']['x']=1; f['Y']['Y']=1; } int main() { memset(f,0,sizeof f); init(); scanf("%s",s); bool fail=0; int len=strlen(s); for(int i=0;i<=len/2;i++) if(f[s[i]][s[len-i-1]]==0) fail=1; if(fail) printf("NIE\n"); else printf("TAK\n"); return 0; }