Codeforces-691B-s-palindrome(模拟)
2016-07-16 14:29
501 查看
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
坑点全在这里
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; }
相关文章推荐
- 【注意】android 百度定位地址
- java学习总结(16.07.16)StringBuffer类和StringBuilderr类
- Valid Sudoku
- EnumHelper.cs枚举助手(枚举描述信息多语言支持)C#
- Android Socks5代理服务器程序开发
- c语言==运算符(7)
- idea15.0在线破解
- 16-07-16 android R cannot be resolved to a variable 原因
- 國罡上廣開土境平安好太王碑
- C# 泛型类型参数的约束
- Codeforces-697B-Barnicle(模拟)
- MySQL连接时报1130错误
- 【AD】AD域Powershell批量添加用户组组织单元20160208
- WebBrowser.ObjectForScripting 属性的使用
- opengl vbo使用技巧
- hdu_1800 Flying to the Mars
- HDFS append: Failed to close file /sys/global/log/sys_20160716.log. Lease recovery is in prog
- Timus 1092. Transversa
- OpenGL---颜色
- Android Studio的安装