题目链接:

  http://codeforces.com/problemset/problem/691/B

题目大意:

  求一个字符串是不是镜像的(不是回文)。是输出TAK否则RE。

题目思路:

  【模拟】

  预处理镜像的字母,注意bd pq,从头尾开始模拟。

  1. //
  2. //by coolxxx
  3. //#include<bits/stdc++.h>
  4. #include<iostream>
  5. #include<algorithm>
  6. #include<string>
  7. #include<iomanip>
  8. #include<map>
  9. #include<stack>
  10. #include<queue>
  11. #include<set>
  12. #include<bitset>
  13. #include<memory.h>
  14. #include<time.h>
  15. #include<stdio.h>
  16. #include<stdlib.h>
  17. #include<string.h>
  18. //#include<stdbool.h>
  19. #include<math.h>
  20. #define min(a,b) ((a)<(b)?(a):(b))
  21. #define max(a,b) ((a)>(b)?(a):(b))
  22. #define abs(a) ((a)>0?(a):(-(a)))
  23. #define lowbit(a) (a&(-a))
  24. #define sqr(a) ((a)*(a))
  25. #define swap(a,b) ((a)^=(b),(b)^=(a),(a)^=(b))
  26. #define mem(a,b) memset(a,b,sizeof(a))
  27. #define eps (1e-8)
  28. #define J 10
  29. #define mod 1000000007
  30. #define MAX 0x7f7f7f7f
  31. #define PI 3.14159265358979323
  32. #define N 204
  33. using namespace std;
  34. typedef long long LL;
  35. int cas,cass;
  36. int n,m,lll,ans;
  37. bool a[N][N];
  38. char s[];
  39. int main()
  40. {
  41. #ifndef ONLINE_JUDGE
  42. // freopen("1.txt","r",stdin);
  43. // freopen("2.txt","w",stdout);
  44. #endif
  45. int i,j,k;
  46. // for(scanf("%d",&cass);cass;cass--)
  47. // for(scanf("%d",&cas),cass=1;cass<=cas;cass++)
  48. while(~scanf("%s",s))
  49. // while(~scanf("%d",&n))
  50. {
  51. a['A']['A']=a['H']['H']=a['I']['I']=a['M']['M']=a['O']['O']=a['o']['o']=a['T']['T']=a['V']['V']=a['U']['U']=a['v']['v']=a['W']['W']=a['w']['w']=a['X']['X']=a['x']['x']=a['Y']['Y']=;
  52. a['b']['d']=a['d']['b']=a['p']['q']=a['q']['p']=;
  53. n=strlen(s);
  54. for(i=,j=n-;i<=j;i++,j--)
  55. {
  56. if(!a[s[i]][s[j]])break;
  57. }
  58. if(i<=j)puts("NIE");
  59. else puts("TAK");
  60. }
  61. return ;
  62. }
  63. /*
  64. //
  65.  
  66. //
  67. */

【模拟】Codeforces 691B s-palindrome的更多相关文章

  1. 贪心+模拟 Codeforces Round #288 (Div. 2) C. Anya and Ghosts

    题目传送门 /* 贪心 + 模拟:首先,如果蜡烛的燃烧时间小于最少需要点燃的蜡烛数一定是-1(蜡烛是1秒点一支), num[g[i]]记录每个鬼访问时已点燃的蜡烛数,若不够,tmp为还需要的蜡烛数, ...

  2. 模拟 Codeforces Round #203 (Div. 2) C. Bombs

    题目地址:http://codeforces.com/problemset/problem/350/C /* 题意:机器人上下左右走路,把其他的机器人都干掉要几步,好吧我其实没读懂题目, 看着样例猜出 ...

  3. 模拟 Codeforces Round #249 (Div. 2) C. Cardiogram

    题目地址:http://codeforces.com/contest/435/problem/C /* 题意:给一组公式,一组数据,计算得到一系列的坐标点,画出折线图:) 模拟题:蛮恶心的,不过也简单 ...

  4. 模拟 Codeforces Round #297 (Div. 2) A. Vitaliy and Pie

    题目传送门 /* 模拟:这就是一道模拟水题,看到标签是贪心,还以为错了呢 题目倒是很长:) */ #include <cstdio> #include <algorithm> ...

  5. queue+模拟 Codeforces Round #304 (Div. 2) C. Soldier and Cards

    题目传送门 /* 题意:两堆牌,每次拿出上面的牌做比较,大的一方收走两张牌,直到一方没有牌 queue容器:模拟上述过程,当次数达到最大值时判断为-1 */ #include <cstdio&g ...

  6. 模拟 Codeforces Round #288 (Div. 2) A. Pasha and Pixels

    题目传送门 /* 模拟水题:给定n*m的空白方格,k次涂色,将(x,y)处的涂成黑色,判断第几次能形成2*2的黑色方格,若不能,输出0 很挫的判断四个方向是否OK */ #include <cs ...

  7. CodeForces - 600C Make Palindrome 贪心

    A string is called palindrome if it reads the same from left to right and from right to left. For ex ...

  8. Codeforces Round 486C - Palindrome Transformation 贪心

    C. Palindrome Transformation time limit per test 1 second memory limit per test 256 megabytes input ...

  9. Codeforces Gym100952 C. Palindrome Again !!-回文字符串 (2015 HIAST Collegiate Programming Contest)

      C. Palindrome Again !!   time limit per test 1 second memory limit per test 64 megabytes input sta ...

随机推荐

  1. jQuery Capty 图片标题插件

    jQuery Capty是可以为图片添加漂亮的字幕的插件 文件包含: <link type="text/css" rel="stylesheet" hre ...

  2. 第九篇:python高级之操作数据库

    python高级之操作数据库   python高级之操作数据库 本节内容 pymysql介绍及安装 使用pymysql执行sql 获取新建数据自增ID fetch数据类型设置 1.pymysql介绍及 ...

  3. 游标中的static参数

    以下测试用例将演示,使用static的游标和不使用的区别: if object_id(N't_test',N'u') is not null drop table t_test go create t ...

  4. tomcat的webapp下的root文件夹的作用是什么

    1.基本一样..只是表示不同的tomcat的http路径而已. root目录默认放的是tomcat自己的一个项目,如:http://localhost:8080/默认访问root项目 对于webapp ...

  5. C蛮的全栈之路-node篇(一) 环境布置

    目录 C蛮的全栈之路-序章 技术栈选择与全栈工程师C蛮的全栈之路-node篇(一) 环境布置C蛮的全栈之路-node篇(二) 实战一:自动发博客 ---------------- 我是分割线 ---- ...

  6. Java线程(学习整理)--1--守护线程

    1.什么是守护线程? 今天老师讲解我才知道有守护线程这回事!原来守护线程经常存在于我们的身边,比如:一个免费的网页游戏,里面都会或多或少有些插入性的广告!! 一般情况下,我们不会去点击这些广告的,但是 ...

  7. [C++]C++类基本语法

    本测试代码包括以下内容: (1)如何使用构造函数:(2)默认构造函数:(3)对象间赋值:(4)const使用语法:(5)定义类常量: 一种方法是用enum,另一种方法是使用static. #inclu ...

  8. Access自动编号的初始值设置及重置编号 转

    方法如下: ALTER TABLE tableName ALTER COLUMN Id COUNTER (100, 5) 其中:tableName为要修改的表名,Id为自动编号列,100为初始值,5为 ...

  9. github 分支 合并

    Git如何进行分支管理?      1.创建分支      创建分支很简单:git branch <分支名>      2.切换分支      git checkout <分支名&g ...

  10. Unix/Linux 'dirctory tree' command.

    ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/' It se ...