D - s-palindrome
Crawling in process...
Crawling failed
Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u
Description
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.
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.
Sample Input
Input
oXoxoXo
Output
TAK
Input
bod
Output
TAK
Input
ER
Output
NIE
大概题意就是:轴对称的字符串输出TAK ,否则输出ER
#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
int len=s.size();
char c[19][2]={'A','A','b','d','d','b','H','H','I','I','M','M','O','O','o',
'o','p','q','q','p','U','U','V','V','v','v','W','W','w','w','X','X','x','x','Y','Y','T','T'};
int flag=0;
for(int i=0;i<=len/2;i++)
{
int fg=0;
for(int j=0;j<19;j++)
{
if(s[i]==c[j][0]&&s[len-i-1]==c[j][1])
{
fg=1;
break;
}
}
if(fg==0)
{
puts("NIE");
flag=1;
break;
}
}
if(flag==0) puts("TAK");
return 0;
}
岂能尽如人意,但求无愧我心