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 ...
随机推荐
- linux中目录处理命令
目录 mkdir cd pwd rmdir cp mv rm mkdir 解释 命令名称:mkdir 命令英文原意:make directories 命令所在路径:/bin/mkdir 执行权限:所有 ...
- mysql设置编码格式--支持中文
创建table的时候就使用utf8编码 在每次创建表的时候都在最后加上 character set = utf8就可以很好的支持中文 create table xxx ( id int auto_in ...
- CentOS6 用yum安装mysql详解,简单实用
一.查看CentOS下是否已安装mysql 输入命令 :yum list installed | grep mysql 二.删除已安装mysql 输入命令: yum -y remove mysql 如 ...
- vuex学习详细解(主页目录
学习vuex过程中,通过 vue-cli命令来配置和使用vuex笔记整理 vue-cli中配置vuex流程和注意事项 vuex目录配置 vuex的states.js vuex的getters.js v ...
- List集合去重各种方式汇总
package com.sb.test; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java. ...
- Linux基础:df命令总结
本文只总结一些常用的用法,更详细的说明见man df和 df --help. df命令 df命令用于显示目前在Linux系统上的文件系统的磁盘使用情况统计. df命令主要是从各文件系统的Super b ...
- AD常用命令以及概念
活动目录服务器常用命令合集如下: net accounts 查看第一台域控的计算机角色net accounts 查看计算机角色net share 查看共享netdom query fs ...
- ext4文件系统启动自检的必要性
最近我们发现多个用户设备掉电后重启,系统不工作. 研究这些返修设备,发现这些设备的表象是网络连接失败,DNS resolve不了.进一步发现/etc/resolv.conf为空,所以应用程序没法进行D ...
- AGC018F - Two Trees
题意 有两棵节点数均为 n 的有根树,你需要构造一个序列 \(X_1,X_2,...,X_n\).使得对于每一棵树的每一个节点, 若令它所有的后代(包括它本身)为 \(a_1,a_2,...,a_k\ ...
- GHM论文笔记(CVPR2019)
目录 作者要解决的问题 Focal loss(CVPR2017) Focal loss的解决方案 Focal loss的不足 设计思路 梯度与样本的关系 梯度分布计算方法:将0-1的梯度切bin,计算 ...