zoukankan      html  css  js  c++  java
  • 【模拟】Codeforces 691B s-palindrome

    题目链接:

      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[1004];
    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']=1;
    52         a['b']['d']=a['d']['b']=a['p']['q']=a['q']['p']=1;
    53         n=strlen(s);
    54         for(i=0,j=n-1;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 0;
    62 }
    63 /*
    64 //
    65 
    66 //
    67 */
    View Code
  • 相关阅读:
    测试发帖
    C# 四舍五入算法(转)
    赚钱,爱好,生活
    c# 当前dll目录
    BlogWriter
    调用com+时,提示 0x800706f7,error msg:占位程序接收到错误数据,(本地调用时提示:不支持此接口)
    测试2
    系统架构设计 & 避免循环引用(转载)
    Visual Studio 2008查找替换用的正则
    Myeclipse webinf/lib包加载问题
  • 原文地址:https://www.cnblogs.com/Coolxxx/p/5814118.html
Copyright © 2011-2022 走看看