Codeforces-691B-s-palindrome(模拟)

B. s-palindrome
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard 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.
这里写图片描述
English alphabet
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

坑点全在这里

#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<queue>
#include<iomanip>
using namespace std;
const int maxn=2222;
bool is_mirror(char A,char B)//A和B成镜像返回1,否则返回0
{
    if(A=='A'&&B=='A')
        return 1;
    if(A=='H'&&B=='H')
        return 1;
    if(A=='I'&&B=='I')
        return 1;
    if(A=='M'&&B=='M')
        return 1;
    if(A=='O'&&B=='O')
        return 1;
    if(A=='T'&&B=='T')
        return 1;
    if(A=='U'&&B=='U')
        return 1;
    if(A=='V'&&B=='V')
        return 1;
    if(A=='W'&&B=='W')
        return 1;
    if(A=='X'&&B=='X')
        return 1;
    if(A=='Y'&&B=='Y')
        return 1;
    if(A=='v'&&B=='v')
        return 1;
    if(A=='w'&&B=='w')
        return 1;
    if(A=='x'&&B=='x')
        return 1;
    if(A=='o'&&B=='o')
        return 1;


    if(A=='p'&&B=='q')//下面几条涨姿势
        return 1;
    if(A=='q'&&B=='p')
        return 1;
    if(A=='b'&&B=='d')
        return 1;
    if(A=='d'&&B=='b')
        return 1;
//    if(A=='d'&&B=='p')
//        return 1;
//    if(A=='p'&&B=='d')
//        return 1;
//    if(A=='b'&&B=='q')
//        return 1;
//    if(A=='q'&&B=='b')
//        return 1;
    return 0;
}
int main()
{
    char str1[maxn];
    scanf("%s",str1);
    int len=strlen(str1);
    char str2[maxn];
    for(int i=0; i<=len-1; i++)
        str2[len-i-1]=str1[i];
    for(int i=0; i<=len-1; i++)
        if(is_mirror(str1[i],str2[i])==0)
        {
            printf("NIE\n");
            return 0;
        }
    printf("TAK\n");
    return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值