【模拟】Codeforces 691B s-palindrome
来源:互联网 发布:cc免费顶级域名注册 编辑:程序博客网 时间:2024/04/30 20:38
题目链接:
http://codeforces.com/problemset/problem/691/B
题目大意:
求一个字符串是不是镜像的(不是回文)。是输出TAK否则RE。
题目思路:
【模拟】
预处理镜像的字母,注意bd pq,从头尾开始模拟。
////by coolxxx//#include<bits/stdc++.h>#include<iostream>#include<algorithm>#include<string>#include<iomanip>#include<map>#include<stack>#include<queue>#include<set>#include<bitset>#include<memory.h>#include<time.h>#include<stdio.h>#include<stdlib.h>#include<string.h>//#include<stdbool.h>#include<math.h>#define min(a,b) ((a)<(b)?(a):(b))#define max(a,b) ((a)>(b)?(a):(b))#define abs(a) ((a)>0?(a):(-(a)))#define lowbit(a) (a&(-a))#define sqr(a) ((a)*(a))#define swap(a,b) ((a)^=(b),(b)^=(a),(a)^=(b))#define mem(a,b) memset(a,b,sizeof(a))#define eps (1e-8)#define J 10#define mod 1000000007#define MAX 0x7f7f7f7f#define PI 3.14159265358979323#define N 204using namespace std;typedef long long LL;int cas,cass;int n,m,lll,ans;bool a[N][N];char s[1004];int main(){#ifndef ONLINE_JUDGE//freopen("1.txt","r",stdin);//freopen("2.txt","w",stdout);#endifint i,j,k;//for(scanf("%d",&cass);cass;cass--)//for(scanf("%d",&cas),cass=1;cass<=cas;cass++)while(~scanf("%s",s))//while(~scanf("%d",&n)){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;a['b']['d']=a['d']['b']=a['p']['q']=a['q']['p']=1;n=strlen(s);for(i=0,j=n-1;i<=j;i++,j--){if(!a[s[i]][s[j]])break;}if(i<=j)puts("NIE");else puts("TAK");}return 0;}/*////*/
0 0
- Codeforces 691B. s-palindrome(模拟)
- Codeforces-691B-s-palindrome(模拟)
- 【模拟】Codeforces 691B s-palindrome
- Codeforces - Educational Codeforces Round 14B - s-palindrome(模拟)
- Codeforces - 339B(div2) - Gena's Code(模拟)
- Educational Codeforces Round 6 B. Grandfather Dovlet’s calculator(模拟)
- Codeforces--629B--Far Relative’s Problem(模拟)
- Codeforces 629B Far Relative’s Problem【模拟】
- [easy]CodeForces-897B Chtholly's request 模拟/找规律
- CodeForces 805B 3-palindrome
- Codeforces 805B 3-palindrome
- CodeForces 451B 模拟
- Codeforces 711B 【模拟】
- 模拟-CodeForces 370B
- CodeForces 644B【模拟】
- Codeforces 745B (模拟)
- codeforces 676b 模拟
- CodeForces 600C Make Palindrome (模拟题)
- ROS Learning-006 beginner_Tutorials 编译ROS程序包
- CSS中!important的使用
- 【linux系统学习笔记】Ubuntu文本界面和图像界面的切换
- It seems that the port 3306 is already in use.aer you sure you want to use this port
- 设计模式之Builder模式
- 【模拟】Codeforces 691B s-palindrome
- 面试之JAVA
- MP4文件格式的解析,以及MP4文件的分割算法
- 面试之JAVAWEB
- webstorm快捷键
- POJ3678 Katu Puzzle (2-SAT检验)
- 面试之J2EE主流框架
- Spark——数据库(Hbase+Mysql)
- 【模拟】Codeforces 691C Exponential notation