B. s-palindrome
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Let's call a string "s-palindrome" if it is symmetric about the middle of the string. For example, the string "oHo" is "s-palindrome", but the string "aa" is not. The string "aa" is not "s-palindrome", because the second half of it is not a mirror reflection of the first half.
![](https://i-blog.csdnimg.cn/blog_migrate/c38d59eadecb15587b76f8f633e1d4f7.png)
You are given a string s. Check if the string is "s-palindrome".
Input
The only line contains the string s (1 ≤ |s| ≤ 1000) which consists of only English letters.
Output
Print "TAK" if the string s is "s-palindrome" and "NIE" otherwise.
Examples
Input
oXoxoXo
Output
TAK
Input
bod
Output
TAK
Input
ER
Output
NIE
题意:给出一个字符串,判断是否对称并为纯镜面对称
模拟呗,做的还是挺开心的,每次做模拟都很开心233333我这是什么神奇倾向
先找出纯镜面对称的所有字母和字母对,u和m不对称,略懵逼,仔细研究了一下确实不对称23333
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <queue>
#include <iostream>
#include <assert.h>
#define INF 0x3f3f3f3f
using namespace std;
int main()
{
char s[1005];
while (scanf("%s", s) != EOF) {
int flag = 0;
for(int i = 0, j = strlen(s) - 1; i < strlen(s) / 2 + 1; i++, j--) {
flag = 0;
char aa = s[i];
char bb = s[j];
switch(aa) {
case 'A':
case 'H':
case 'I':
case 'M':
case 'O':
case 'o':
case 'T':
case 'U':
case 'V':
case 'v':
case 'W':
case 'w':
case 'X':
case 'x':
case 'Y': flag = 1; break;
case 'b': flag = 2; break;
case 'p': flag = 3; break;
case 'd': flag = 4; break;
case 'q': flag = 5; break;
}
if(flag == 1 && aa == bb) continue;
if(flag == 2 && bb == 'd') continue;
if(flag == 3 && bb == 'q') continue;
if(flag == 4 && bb == 'b') continue;
if(flag == 5 && bb == 'p') continue;
if(strlen(s) % 2 && i == strlen(s) / 2 + 1 && flag != 1) flag = 6;
flag = 6; break;
}
if(flag != 6) printf("TAK\n");
else printf("NIE\n");
}
return 0;
}