题目链接:

B. s-palindrome

题意:

问给定的字符串是否是镜面对称;

思路:

直接看哪些字母是镜面对称的就行;

AC代码:

//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath> using namespace std; #define For(i,j,n) for(int i=j;i<=n;i++)
#define mst(ss,b) memset(ss,b,sizeof(ss)); typedef long long LL; template<class T> void read(T&num) {
char CH; bool F=false;
for(CH=getchar();CH<''||CH>'';F= CH=='-',CH=getchar());
for(num=;CH>=''&&CH<='';num=num*+CH-'',CH=getchar());
F && (num=-num);
}
int stk[], tp;
template<class T> inline void print(T p) {
if(!p) { puts(""); return; }
while(p) stk[++ tp] = p%, p/=;
while(tp) putchar(stk[tp--] + '');
putchar('\n');
} //const LL mod=1e9+7;
const double PI=acos(-1.0);
const LL inf=1e18;
const int N=2e5+;
const int maxn=;
const double eps=1e-; char s[],str[]; int check(char x ,char y)
{
if(x=='A'&&y=='A')return ;
if(x=='I'&&y=='I')return ;
if(x=='M'&&y=='M')return ;
if(x=='O'&&y=='O')return ;
if(x=='T'&&y=='T')return ;
if(x=='H'&&y=='H')return ;
if(x=='U'&&y=='U')return ;
if(x=='W'&&y=='W')return ;
if(x=='X'&&y=='X')return ;
if(x=='Y'&&y=='Y')return ;
if(x=='V'&&y=='V')return ;
if(x=='x'&&y=='x')return ;
if(x=='w'&&y=='w')return ;
if(x=='o'&&y=='o')return ;
if(x=='v'&&y=='v')return ;
//if(x=='m'&&y=='m')return 1;
//if(x=='n'&&y=='n')return 1;
// if(x=='i'&&y=='i')return 1;
if(x=='p'&&y=='q')return ;
if(x=='q'&&y=='p')return ;
if(x=='b'&&y=='d')return ;
if(x=='d'&&y=='b')return ;
return ;
}
int main()
{
scanf("%s",s);
int len=strlen(s);
For(i,,len-)
{
str[len-i-]=s[i];
}
For(i,,len-)
{
if(!check(s[i],str[i]))
{
// cout<<s[i]<<" "<<str[i]<<endl;
cout<<"NIE";
return ;
}
}
cout<<"TAK";
return ;
}
05-11 03:30