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 题意: 给定大 ...
随机推荐
- Java基础学习总结(9)——this关键字
一.this关键字 this是一个引用,它指向自身的这个对象. 看内存分析图: 假设我们在堆内存new了一个对象,在这个对象里面你想象着他有一个引用this,this指向这个对象自己,所以这就是thi ...
- ArcGIS api for javascript——图层-创建定制的切片图层类型的图层
描述 本例展示了如何创建一个定制图层,该图层访问来自WEB服务器的地图切片.这种方式最通用的用途是检索ArcGIS Server 9.2切片缓存或web上的其他地图切片服务.尽管本例使用的是一个Arc ...
- 查看SQLSERVER当前正在运行的sql信息
能够使用SQL Profiler捕捉在SQL Server实例上运行的活动.这种活动被称为Profiler跟踪.这个就不多说了,大家都知道,以下是使用代码为实现同样的效果. SET TRANSACTI ...
- 英语音乐---一、Scarborough Fair
英语音乐---一.Scarborough Fair 一.总结 一句话总结:斯卡布罗集市 <斯卡布罗集市>诉说了一个缠绵凄美的爱情故事:一个参军的男青年远离自己相爱的姑娘在战争中不幸遇难,但 ...
- AIX 系统补丁格式
AIX 系统版本标准格式: 5300-06-11-0918 VR00-TL-SP-YYWW 5300-06-11-0918 ^-------- YYWW(2009年第 ...
- 使用iVMS-4200 存储录像数据时的设置
1.安装软件时,选择:存储服务器 2.对存储服务器进行配置,具体配置见 配置手册.
- MVC权限验证过滤器
Action属性,权限设定属性 [AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = false)] ...
- Python基础班培训视频课程
课程目录:│ ├─第01天视频│ │ 01-课程介绍.avi│ │ 02-什么是操作系统.avi│ │ 03-生活中的操作系统.avi│ │ 04-操 ...
- Docker中运行MySQL5.7并挂载宿主机目录到镜像
原文:Docker中运行MySQL5.7并挂载宿主机目录到镜像 1.1 拉取mysql镜像 docker pull mysql:5.7 1.2 创建用于挂载的目录 mkdir -p /data/mys ...
- python编程练习
python练习之冒泡排序: python代码: #coding=utf-8 if __name__=="__main__": arr=[3,2,1,7,11,4,5,8] pri ...