虽然是水题,但是容易错。参照了紫书的代码可以写的很简洁。主要还是注意常量数组的使用,能让代码变得简单许多

 #include <iostream>
#include <cstdio>
#include <string.h>
#include <algorithm>
#include <stack>
#include <math.h>
#pragma warning ( disable : 4996 ) using namespace std; int Max( int a, int b ) { return a>b?a:b; }
int Min( int a, int b ) { return a>b?b:a; } const int inf = 0x3f3f3f3f;
const int maxn = + ;
const char T[] = "A...3..HIL.JM.O...2TUVWXY51SE.Z..8.";
char test[]; char getM( char c )
{
if (isalpha(c)) return T[c-'A'];
else return T[c-''+];
}
int main()
{
while ( ~scanf("%s", test) )
{
int len = strlen(test);
bool isP = true, isM = true;
for ( int i = ; i < (len+) / ; i++ )
{
if ( test[i] != test[len--i] ) isP = false;
if ( getM(test[i]) != test[len--i] ) isM = false;
}
if ((!isP)&&(!isM)) printf( "%s -- is %s\n\n", test, "not a palindrome." );
if (isP&&(!isM)) printf( "%s -- is %s\n\n", test, "a regular palindrome." );
if ((!isP)&&isM) printf( "%s -- is %s\n\n", test, "a mirrored string." );
if (isP&&isM) printf( "%s -- is %s\n\n", test, "a mirrored palindrome." );
}
return ;
}

最新文章

  1. python之最强王者(2)——python基础语法
  2. C# Winform防止一个程序重复运行
  3. Android原生(Native)C开发之一:环境搭建篇
  4. HighChart报表之饼图
  5. Notes on &#39;Selective Search For Object Recognition&#39;
  6. linux 打开远程samba服务器
  7. CentOS使用ufw的方法
  8. java.lang.OutOfMemoryError: Java heap space错误及处理办法
  9. 2.x ESL第二章习题 2.8
  10. leetcode算法刷题(二)——动态规划(一)
  11. Docker 三剑客之 Compose
  12. 在VCS仿真器中使用FSDB
  13. Django(四) ORM 外键操作及初识Ajax
  14. SpringMVC从认识到细化了解
  15. 容器技术|Docker三剑客之docker-compose
  16. Robust Real-time Object Detection学习
  17. Spring源码阅读(四)
  18. SSRF攻击-运用gopher协议构造POST包--emmmm(http://10.112.68.215:10004/index.php?action=login)
  19. 微服务之kong+consul(二)
  20. absolute绝对定位的非绝对定位用法

热门文章

  1. Java编译与反编译命令记录
  2. AWS云管理平台
  3. Python全栈开发:线程代码实例
  4. Array.prototype.splice()
  5. webpack英文文档
  6. [转]C#操作Excel初探
  7. 介绍了Apache日志文件每条数据的请意义以及一些实用日志分析命令
  8. Django + Uwsgi + Nginx 的生产环境部署实战
  9. String方法之fromCharCode()和charCodeAt()
  10. Jtopo使用中link中文字与link平行