【模拟】Codeforces 691B s-palindrome
题目链接:
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 204
- using namespace std;
- typedef long long LL;
- int cas,cass;
- int n,m,lll,ans;
- bool a[N][N];
- char s[];
- int main()
- {
- #ifndef ONLINE_JUDGE
- // freopen("1.txt","r",stdin);
- // freopen("2.txt","w",stdout);
- #endif
- int 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']=;
- a['b']['d']=a['d']['b']=a['p']['q']=a['q']['p']=;
- n=strlen(s);
- for(i=,j=n-;i<=j;i++,j--)
- {
- if(!a[s[i]][s[j]])break;
- }
- if(i<=j)puts("NIE");
- else puts("TAK");
- }
- return ;
- }
- /*
- //
- //
- */
【模拟】Codeforces 691B s-palindrome的更多相关文章
- 贪心+模拟 Codeforces Round #288 (Div. 2) C. Anya and Ghosts
题目传送门 /* 贪心 + 模拟:首先,如果蜡烛的燃烧时间小于最少需要点燃的蜡烛数一定是-1(蜡烛是1秒点一支), num[g[i]]记录每个鬼访问时已点燃的蜡烛数,若不够,tmp为还需要的蜡烛数, ...
- 模拟 Codeforces Round #203 (Div. 2) C. Bombs
题目地址:http://codeforces.com/problemset/problem/350/C /* 题意:机器人上下左右走路,把其他的机器人都干掉要几步,好吧我其实没读懂题目, 看着样例猜出 ...
- 模拟 Codeforces Round #249 (Div. 2) C. Cardiogram
题目地址:http://codeforces.com/contest/435/problem/C /* 题意:给一组公式,一组数据,计算得到一系列的坐标点,画出折线图:) 模拟题:蛮恶心的,不过也简单 ...
- 模拟 Codeforces Round #297 (Div. 2) A. Vitaliy and Pie
题目传送门 /* 模拟:这就是一道模拟水题,看到标签是贪心,还以为错了呢 题目倒是很长:) */ #include <cstdio> #include <algorithm> ...
- queue+模拟 Codeforces Round #304 (Div. 2) C. Soldier and Cards
题目传送门 /* 题意:两堆牌,每次拿出上面的牌做比较,大的一方收走两张牌,直到一方没有牌 queue容器:模拟上述过程,当次数达到最大值时判断为-1 */ #include <cstdio&g ...
- 模拟 Codeforces Round #288 (Div. 2) A. Pasha and Pixels
题目传送门 /* 模拟水题:给定n*m的空白方格,k次涂色,将(x,y)处的涂成黑色,判断第几次能形成2*2的黑色方格,若不能,输出0 很挫的判断四个方向是否OK */ #include <cs ...
- 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 ...
- Codeforces Round 486C - Palindrome Transformation 贪心
C. Palindrome Transformation time limit per test 1 second memory limit per test 256 megabytes input ...
- 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 ...
随机推荐
- jQuery Capty 图片标题插件
jQuery Capty是可以为图片添加漂亮的字幕的插件 文件包含: <link type="text/css" rel="stylesheet" hre ...
- 第九篇:python高级之操作数据库
python高级之操作数据库 python高级之操作数据库 本节内容 pymysql介绍及安装 使用pymysql执行sql 获取新建数据自增ID fetch数据类型设置 1.pymysql介绍及 ...
- 游标中的static参数
以下测试用例将演示,使用static的游标和不使用的区别: if object_id(N't_test',N'u') is not null drop table t_test go create t ...
- tomcat的webapp下的root文件夹的作用是什么
1.基本一样..只是表示不同的tomcat的http路径而已. root目录默认放的是tomcat自己的一个项目,如:http://localhost:8080/默认访问root项目 对于webapp ...
- C蛮的全栈之路-node篇(一) 环境布置
目录 C蛮的全栈之路-序章 技术栈选择与全栈工程师C蛮的全栈之路-node篇(一) 环境布置C蛮的全栈之路-node篇(二) 实战一:自动发博客 ---------------- 我是分割线 ---- ...
- Java线程(学习整理)--1--守护线程
1.什么是守护线程? 今天老师讲解我才知道有守护线程这回事!原来守护线程经常存在于我们的身边,比如:一个免费的网页游戏,里面都会或多或少有些插入性的广告!! 一般情况下,我们不会去点击这些广告的,但是 ...
- [C++]C++类基本语法
本测试代码包括以下内容: (1)如何使用构造函数:(2)默认构造函数:(3)对象间赋值:(4)const使用语法:(5)定义类常量: 一种方法是用enum,另一种方法是使用static. #inclu ...
- Access自动编号的初始值设置及重置编号 转
方法如下: ALTER TABLE tableName ALTER COLUMN Id COUNTER (100, 5) 其中:tableName为要修改的表名,Id为自动编号列,100为初始值,5为 ...
- github 分支 合并
Git如何进行分支管理? 1.创建分支 创建分支很简单:git branch <分支名> 2.切换分支 git checkout <分支名&g ...
- Unix/Linux 'dirctory tree' command.
ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/' It se ...