Codeforce 474A - Keyboard
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 <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
const int N=;
const int mod=1e9+;
int a[];
int main()
{
string a="qwertyuiopasdfghjkl;zxcvbnm,./";
char b,c[];
scanf("%c%s",&b,c);
for(int j=;j<strlen(c);j++)
for(int i=;i<a.size();i++){
if(a[i]==c[j]){
if(b=='L')
printf("%c",a[i+]);
else
printf("%c",a[i-]);
break;
}
}
return ;
}
Codeforce 474A - Keyboard的更多相关文章
- Codeforces 474A Keyboard (水
题目链接:点击打开链接 键盘移位了,问输出相应的字母 #include <cstdio> #include <cstring> char a[105]; char b[3][1 ...
- CodeForces 474A Keyboard (水题)
题意:给定一个键盘,然后一行字母,和一个字符,代表把那一行字母在键盘上左移还是右移一位. 析:没什么好说的,直接暴力就好. 代码如下: #include<bits/stdc++.h> us ...
- [CodeForce 801A] Vicious Keyboard
题目链接:http://codeforces.com/problemset/problem/801/A 思路:题目中字符串的长度最长100个字符,所以,可以考虑用暴力,先遍历一遍匹配"VK& ...
- Fedora 22中的Locale and Keyboard Configuration
Introduction The system locale specifies the language settings of system services and user interface ...
- android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
<activity android:name="xxxActivity" android:configChanges="keyboard|keyboardHidde ...
- USB Keyboard Recorder
catalogue . 引言 . Device Class Definition for Human Interface Devices (HID) . USB HID Report Descript ...
- imx6 matrix keyboard
imx6需要添加4x4的矩阵键盘.本文记录添加方法. 参考链接 http://processors.wiki.ti.com/index.php/TI-Android-JB-PortingGuide h ...
- Codeforces Round #389 Div.2 B. Santa Claus and Keyboard Check
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- UVa 11998 Broken Keyboard (数组模拟链表问题)
题目链接: 传送门 Broken Keyboard #include<bits/stdc++.h> using namespace std; char str[100010]; int m ...
随机推荐
- Mybatis注解开发多表一对一,一对多
Mybatis注解开发多表一对一,一对多 一对一 示例:帐户和用户的对应关系为,多个帐户对应一个用户,在实际开发中,查询一个帐户并同时查询该账户所属的用户信息,即立即加载且在mybatis中表现为一对 ...
- 改造SuperMap的DrawHandler接口,自定义绘制的图形样式
超图WebGL三维接口中有一个绘制的接口(new Cesium.DrawHandler(viewer, mode, clampMode),它封装了绘制完之后的式样,画完之后捕捉绘制完成的实体有一定的难 ...
- 1.3.5 详解项目中的资源——Android第一行代码(第二版)笔记
所有以drawable开头的文件夹都是用来存放图片的. 所有以mipmap开头的文件夹都是用来存放应用图标的 所有以values开头的文件夹都是用来存放字符串.样式.颜色等配置的, layout文件夹 ...
- 0x01 C语言-编写第一个hello world
学习每一个编程语言都是从 "Hello world!" 开始的,这好像就是编程界一条不成文的规定一样. 在这篇文章中,我将教大家编写一个可以输出 "Hello world ...
- 【seata源码学习】001 - seata-server的配置读取和服务注册
github, seata vergilyn seata-fork seata.io zh-cn docs (PS. 随缘看心情写,坚持不了几天.文章还是写的超级的烂,排版也奇差无比~~~~ 脑壳疼~ ...
- asp.net mvc 使用AuthorizeAttribute做授权验证
授权验证,比如登陆验证 1.自定义属性继承AuthorizeAttribute 2.重写OnAuthorization方法 3.通过AllowAnonymousAttribute特性处理无需授权的Ac ...
- MySQL日志文件和InnoDB引擎文件简介
MySQL和InnoDB的关系不在这里介绍了.但是大家都知道其中相关的文件很多,类型很多.看文件名就有点分布清楚了.所以在这里简单介绍下他们的文件. 我们直接看文件列表以及在后面直接加注释.做笔记. ...
- Windos framework .net 3.5规则失败
1. 安装的时候有一个.net警告,这里给后边造成了一个隐患,实际上是wondows少了一个framework .net的插件,跟SQLserver安装本身没关系,一开始忽略了,后边就报错了. 2.点 ...
- docker常见操作总结
一.原理 1.Hypervisor是一种运行在物理服务器和操作系统之间的中间软件层,可允许多个操作系统和应用共享一套基础物理硬件,它能直接访问物理设备,会给每一台虚拟机分配内存.CPU.网络.磁盘等资 ...
- JS中require函数的警告提示
在JS中常常使用require函数来引入文件或者路径,不过在使用时需要注意一点,它的参数必须是一串完整的字符串常量或者是由字符常量与变量拼接. (一)require函数的参数为一个变量,如下图所示: ...