【链接】 我是链接,点我呀:)

【题意】

在这里输入题意

【题解】

如果一个字符没有对应的镜像,那么它对应的是一个空格。
然后注意
aba这种情况。
这种情况下b也要查一下它的镜像是不是和b一样。

【错的次数】

在这里输入错的次数

【反思】

在这里输入反思

【代码】

#include <bits/stdc++.h>
using namespace std; const char * rev = {"A 3 HIL JM O 2TUVWXY51SE Z 8 "};
const char * msg[] = {"is not a palindrome.","is a regular palindrome.",
"is a mirrored string.","is a mirrored palindrome."}; const int N = 100;
char s[N]; char re(char ch)
{
if (isalpha(ch))
return rev[ch-'A'];
return rev[ch-'0'+25];
} int main()
{
//freopen("F:\\rush.txt","r",stdin);
while (~scanf("%s",s))
{
int len = strlen(s);
int x = 1,y = 1;
for (int i = 0;i < (len+1)/2;i++)
{
if (s[i]!=s[len-i-1]) x = 0;
if (re(s[i])!=s[len-i-1]) y = 0;
}
printf("%s -- %s\n\n",s,msg[y*2+x]);
}
return 0;
}

【例题3-3 UVA - 401】Palindromes的更多相关文章

  1. uva 401.Palindromes

    题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem ...

  2. uva 401 Palindromes 解题报告

    题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...

  3. UVa 401 Palindromes(镜像回文字符串)

     题意  给一个字符串 判定其是否为回文串和镜像串  回文串非常好推断  镜像串对于每个字符用数组保存它的镜像字符即可了  没有的就是空格 注意若字符串长度为奇数  中间那个字母必须是对称的才是镜 ...

  4. UVa 401 - Palindromes 解题报告 - C语言

    1.题目大意 输入字符串,判断其是否为回文串或镜像串.其中,输入的字符串中不含0,且全为合法字符.以下为所有的合法字符及其镜像: 2.思路 (1)考虑使用常量数组而不是if或switch来实现对镜像的 ...

  5. Palindromes UVA - 401

    ​ A regular palindrome is a string of numbers or letters that is the same forward as backward. For e ...

  6. UVA大模拟代码(白书训练计划1)UVA 401,10010,10361,537,409,10878,10815,644,10115,424,10106,465,10494

    白书一:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=64609#overview 注意UVA没有PE之类的,如果PE了显示WA. UVA ...

  7. 401 Palindromes(回文词)

      Palindromes  A regular palindrome is a string of numbers or letters that is the same forward as ba ...

  8. 【UVA 401】BUPT 2015 newbie practice #2 div2-B-Palindromes

    http://acm.hust.edu.cn/vjudge/contest/view.action?cid=102419#problem/B A regular palindrome is a str ...

  9. 【鬼畜】UVA - 401每日一题·猛男就是要暴力打表

    管他什么rev数组,msg数组简化代码 #define _CRT_SECURE_NO_WARNINGS #include <cmath> #include <iostream> ...

随机推荐

  1. 二分图简单概念&&HDU 2063

    二分图: 二分图又称作二部图,是图论中的一种特殊模型. 设G=(V,E)是一个无向图,如果顶点V可分割为两个互不相交的子集(A,B),并且图中的每条边(i,j)所关联的两个顶点i和j分别属于这两个不同 ...

  2. double 失真例子

    public static void main(String[] args) {  // TODO Auto-generated method stub  double ab=821.20;  dou ...

  3. IE兼容性开发的笔记

    当前项目组开发的产品对外承诺支持IE9和IE11,但在推广应用过程中发现存在相当比例的用户实际上还在使用IE8.而这相当比例中的用户还包含了大部分的公司领导.为了满足公司内部各阶层人士体验我们产品的诉 ...

  4. 怎样在nat方式的虚拟机下做ssh连接

    很多人在本机做測试都是用桥接的方式让虚拟机上网. 假设ip地址紧张或者根本就不同意我们拥有一个局域网的ip.这时候便能够使用NAT方式+putty来远程操作. 第一步,打开设备-Network-更改网 ...

  5. absolute、relative,toggle()

    測试代码例如以下: <div> <div class="global">不应用样式</div> <div class="glob ...

  6. 保留的 IPv4 地址

    保留的IP地址   https://en.wikipedia.org/wiki/Reserved_IP_addresses 地址块(CIDR) 范围 地址数量 范围 目的 0.0.0.0/8 0.0. ...

  7. 28.semaphore跨进程通信

    根据id创建Semaphore,并初始化有一个信号量可用 name类型是char *...; HANDLE hsem = CreateSemaphoreA(NULL, 1, , name); 关闭句柄 ...

  8. 基于mybatis的BaseDao及BaseService深度结合(转)

    原文地址:http://zhaoshijie.iteye.com/blog/2003209 关键字:Mybatis通用DAO设计封装(mybatis) 说明: mybatis默认分页机制为逻辑分页,所 ...

  9. Eclipse导入Maven项目出现错误:Unsupported IClasspathEntry kind=4

    使用Eclipse导入Maven项目失败,提示: An internal error occurred during: "Importing Maven projects". Un ...

  10. sass工具、相关插件

    http://koala-app.com/index-zh.html 下载koala 把css文件夹(包含.scss后缀的文件)整个拖进去: 然后在sublime打开.scss文件编译,自动生成css ...