A. Keyboard Codeforces Round #271(div2)
2 seconds
256 megabytes
standard input
standard output
Our good friend Mole is trying to code a big message. He is typing on an unusual keyboard with characters arranged in following way:
qwertyuiop
asdfghjkl;
zxcvbnm,./
Unfortunately Mole is blind, so sometimes it is problem for him to put his hands accurately. He accidentally moved both his hands with one position to the left or to the right. That means that now he presses not a button he wants, but one neighboring button
(left or right, as specified in input).
We have a sequence of characters he has typed and we want to find the original message.
First line of the input contains one letter describing direction of shifting ('L' or 'R' respectively
for left or right).
Second line contains a sequence of characters written by Mole. The size of this sequence will be no more than 100. Sequence contains only symbols that appear on Mole's
keyboard. It doesn't contain spaces as there is no space on Mole's keyboard.
It is guaranteed that even though Mole hands are moved, he is still pressing buttons on keyboard and not hitting outside it.
Print a line that contains the original message.
R
s;;upimrrfod;pbr
allyouneedislove
代码:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
char s[100]={'q','w','e','r','t','y','u','i','o','p','a','s','d','f','g','h','j','k','l',';','z','x','c','v','b','n','m',',','.','/'};
char s2[200];
int main()
{
char d[10];
scanf("%s",d);
scanf("%s",s2);
if(d[0]=='L')
{
int n=strlen(s2);
for(int i=0;i<n;i++)
{
for(int j=0;j<30;j++)
{
if(s2[i]==s[j])
{
printf("%c",s[j+1]);
break;
}
}
}
printf("\n");
}
else
{
int n=strlen(s2);
for(int i=0;i<n;i++)
{
for(int j=0;j<30;j++)
{
if(s2[i]==s[j])
{
printf("%c",s[j-1]);
break;
}
}
}
printf("\n");
}
return 0;
}
A. Keyboard Codeforces Round #271(div2)的更多相关文章
- D. Flowers Codeforces Round #271(div2)
D. Flowers time limit per test 1.5 seconds memory limit per test 256 megabytes input standard input ...
- B. Worms Codeforces Round #271 (div2)
B. Worms time limit per test 1 second memory limit per test 256 megabytes input standard input outpu ...
- Codeforces Round #271 (Div. 2)题解【ABCDEF】
Codeforces Round #271 (Div. 2) A - Keyboard 题意 给你一个字符串,问你这个字符串在键盘的位置往左边挪一位,或者往右边挪一位字符,这个字符串是什么样子 题解 ...
- Codeforces Round #539 div2
Codeforces Round #539 div2 abstract I 离散化三连 sort(pos.begin(), pos.end()); pos.erase(unique(pos.begin ...
- 【前行】◇第3站◇ Codeforces Round #512 Div2
[第3站]Codeforces Round #512 Div2 第三题莫名卡半天……一堆细节没处理,改一个发现还有一个……然后就炸了,罚了一啪啦时间 Rating又掉了……但是没什么,比上一次好多了: ...
- Codeforces Round#320 Div2 解题报告
Codeforces Round#320 Div2 先做个标题党,骗骗访问量,结束后再来写咯. codeforces 579A Raising Bacteria codeforces 579B Fin ...
- Codeforces Round #564(div2)
Codeforces Round #564(div2) 本来以为是送分场,结果成了送命场. 菜是原罪 A SB题,上来读不懂题就交WA了一发,代码就不粘了 B 简单构造 很明显,\(n*n\)的矩阵可 ...
- Codeforces Round #361 div2
ProblemA(Codeforces Round 689A): 题意: 给一个手势, 问这个手势是否是唯一. 思路: 暴力, 模拟将这个手势上下左右移动一次看是否还在键盘上即可. 代码: #incl ...
- Codeforces Round #626 Div2 D,E
比赛链接: Codeforces Round #626 (Div. 2, based on Moscow Open Olympiad in Informatics) D.Present 题意: 给定大 ...
随机推荐
- 紫书 例题 10-15 UVa 1638(递推)
从大到小安排杆子 分三种情况 (1)插到最左边,那么左边看到了杆子会多一个 (2)插到最右边,那么右边看到了杆子会多一个 (3)插到中间边,那么不影响左边和右边看到的杆子数 具体看代码 #includ ...
- ArcGIS api for javascript——明确的创建图层列表
描述 本例展示了如何确切地创建一个地图服务里的图层列表.这个列表由HTML checkboxe组成,可用用于开关图层的可见性. 函数updateLayerVisibility()包含开关图层的逻辑.函 ...
- uva 473(dp)
题意:按创作时间给出n首歌每首歌的时间ti,然后按创作时间装到m个光盘内,给出光盘最大分钟数t,问m个光盘最多总共放多少首歌. 题解:对于每首歌都能够选或者不选,假设选择了这首歌,是否把这首歌当做第j ...
- linux(debian/ubuntu)下连接安卓手机--小米4为例
更改:如今小米连接Ubuntu等Linux系统,直接改动手机上的连接方式就可以. --------------------------------------------- 因为安卓手机底层就是lin ...
- 如何卸载visualsvn for visual studio
新入职的公司,电脑上的visual studio已经安装了visualsvn 尝试在tools-->extensions and updates中卸载 但是uninstall按钮是被禁用掉的 谷 ...
- P3908 异或之和
题目描述 求1 \bigoplus 2 \bigoplus\cdots\bigoplus N1⨁2⨁⋯⨁N 的值. A \bigoplus BA⨁B 即AA , BB 按位异或. 输入输出格式 输入格 ...
- Cisco交换机解决网络蠕虫病毒入侵问题
Cisco交换机解决网络蠕虫病毒入侵问题 今年来网络蠕虫泛滥给ISP和企业都造成了巨大损失,截至目前已发现近百万种病毒及木马.受感染的网络基础设施遭到破坏,以Sql Slammer为 ...
- Ionic2集成ArcGIS JavaScript API.md
1. Ionic同原生ArcGIS JavaScript API结合 1.1. 安装esri-loader 在工程目录下命令行安装: npm install angular2-esri-loader ...
- org.xml.sax.SAXParseException: Content is not allowed in prolog
sax错误:org.xml.sax.SAXParseException: Content is not allowed in prolog解决 标签: org. xml. sax. saxparse ...
- 原型,构造函数,实例,__proto__
再说说__proto__,这个孩子性格慢向,所以即使在现代浏览器广为支持得今天也不建议使用,性能特别慢,而且影响所有来自该[[prototype]]的对象.只是拿出来了解了解: 1.它是个啥? 原型对 ...