题目链接:http://codeforces.com/contest/474/problem/A

解题报告:一个矩形的键盘,上面只有规定的字符,现在按的时候总是会向某个方向按偏,也就是输入一串字符后,这串字符其实不是我要输入的字符,偏的方向只有左跟右,现在给你每次偏的方向跟输入的字符,让你求原来想要的字符串。注意不会出现按到键盘外的情况。

直接键盘上所有的字符先存到一起,然后左偏取的时候+1,右偏取的时候-1就行了。

 #include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std; char str[];
int main()
{
char ch[];
char dir[] = "qwertyuiopasdfghjkl;zxcvbnm,./";
while(scanf("%s",ch)!=EOF)
{
scanf("%s",str);
int flag = -;
if(ch[] == 'L') flag = ;
int len = strlen(str),n = strlen(dir);
for(int i = ;i < len;++i)
{
for(int j = ;j < n;++j)
if(dir[j] == str[i])
{
printf("%c",dir[j+flag]);
break;
}
}
puts("");
}
return ;
}

Codeforces 271 Div 2 A Keyboard的更多相关文章

  1. Codeforces Round #271 (Div. 2)-A. Keyboard

    http://codeforces.com/problemset/problem/474/A A. Keyboard time limit per test 2 seconds memory limi ...

  2. Codeforces 271 Div 2 C. Captain Marmot

    题目链接:http://codeforces.com/contest/474/problem/C 解题报告:给一个n,然后输入4*n个平面坐标系上的点,每四个点是一组,每个点有一个中心,这四个点可以分 ...

  3. Codeforces 271 Div 2 B. Worms

    题目链接:http://codeforces.com/contest/474/problem/B 解题报告:给你n个堆,第i个堆有ai个物品,物品的编号从1开始,第一堆的编号从1到a1,第二堆编号从a ...

  4. codeforces#271 (Div. 2)预处理

    B. Worms time limit per test 1 second memory limit per test 256 megabytes input standard input outpu ...

  5. Codeforces Round #271 (Div. 2)题解【ABCDEF】

    Codeforces Round #271 (Div. 2) A - Keyboard 题意 给你一个字符串,问你这个字符串在键盘的位置往左边挪一位,或者往右边挪一位字符,这个字符串是什么样子 题解 ...

  6. Codeforces #344 Div.2

    Codeforces #344 Div.2 Interview 题目描述:求两个序列的子序列或操作的和的最大值 solution 签到题 时间复杂度:\(O(n^2)\) Print Check 题目 ...

  7. Codeforces #345 Div.1

    Codeforces #345 Div.1 打CF有助于提高做题的正确率. Watchmen 题目描述:求欧拉距离等于曼哈顿距离的点对个数. solution 签到题,其实就是求有多少对点在同一行或同 ...

  8. Codeforces Beta Round #27 (Codeforces format, Div. 2)

    Codeforces Beta Round #27 (Codeforces format, Div. 2) http://codeforces.com/contest/27 A #include< ...

  9. Codeforces#441 Div.2 四小题

    Codeforces#441 Div.2 四小题 链接 A. Trip For Meal 小熊维尼喜欢吃蜂蜜.他每天要在朋友家享用N次蜂蜜 , 朋友A到B家的距离是 a ,A到C家的距离是b ,B到C ...

随机推荐

  1. sql总结一

    建表: select * from fruit; create table fruit ( id varchar(10) not null, name varchar(20) default '' n ...

  2. java编程思想-java中的并发(二)

    二.共享受限资源 有了并发就可以同时做多件事情了.但是,两个或多个线程彼此互相干涉的问题也就出现了.如果不防范这种冲突,就可能发生两个线程同时试图访问同一个银行账户,或向同一个打印机打印,改变同一个值 ...

  3. accept()

    在一个套接口接受一个连接.accept()是c语言中网络编程的重要的函数,windows系统在#include<winsock.h> ,而linux系统在#include <sys/ ...

  4. Zipf定律

    http://www.360doc.com/content/10/0811/00/84590_45147637.shtml 英美在互联网具有绝对霸权 Zipf定律是美国学者G.K.齐普夫提出的.可以表 ...

  5. ubuntu亮度调节失效

    ctrl+alt+T 打开终端 输入下面的指令 sudo touch /usr/share/X11/xorg.conf.d/20-intel.conf 2 再输入下面的指令: sudo gedit / ...

  6. Sky Box

    http://www.keithlantz.net/2011/10/rendering-a-skybox-using-a-cube-map-with-opengl-and-glsl/ http://o ...

  7. Iframe 在项目中的使用总结

    参考:http://www.cnblogs.com/MaxIE/archive/2008/08/13/1266597.html 问题一:首先我们用iframe加载页面,第一个需要解决的问题是高度自适应 ...

  8. yii2嵌入微信公众号支付

    原文地址:https://segmentfault.com/a/1190000005114556

  9. 注册Com组件..

    开发一些第三方的接口或者功能时..有时会需要接入对方提供Com组件..是一个dll文件.. 这个文件会在你的程序中引用.. 比如一个CMBChina.dll文件..这是招商银行的支付开发时必备的.. ...

  10. CentOS更改yum源与更新系统

    [1] 首先备份/etc/yum.repos.d/CentOS-Base.repo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/Cent ...