题目链接: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. Hibernate 配置文件与映射文件 总结

    hibernate是一个彻底的ORM(Object Relational Mapping,对象关系映射)开源框架. 一.Hibernate配置文件详解 Hibernate配置文件有两种形式:XML与p ...

  2. cobbler深入学习

    cobbler重要目录和cobbler各对象的关系 /var/www/cobbler/ks_mirror 存放操作系统镜像/var/www/cobbler/repo_mirror 存放仓库镜像/var ...

  3. AngularJs:String类型和JSON相互转换

    最近一周做了一个页面,制作的过程中遇到各种问题,从中可以看出本人的js基础还不够扎实,angularjs也只是刚入门的水平,现在将制作过程中遇到的问题一一汇总,方便以后查阅. 一.String类型和J ...

  4. ServiceStack.Text 更快的序列化

    Json.net 是以前最经常用的序列化组件,后来又注意到ServiceStack号称最快的,所以我做了以下测试 1)Json.net using System; using System.Colle ...

  5. (转)Rest介绍

    参考文献:Rest简介 REST是一种组织Web服务的架构,其只在架构方面提出了一系列约束. 关于Restful的无状态 所以在stackoverflow中,我们常常会看到有人问:我现在使用了这样一种 ...

  6. Flash Builder 4.7 破解

    http://litech.diandian.com/post/2013-03-22/40049178994 Adobe Flash Builder 4.7 For Mac 破解 和Photoshop ...

  7. Install Mono and MonoDevelop on Fedora

    http://www.mono-project.com/docs/getting-started/install/linux/ http://www.monodevelop.com/download/ ...

  8. Linux笔记-常用的命令(15-3-30)

    vim命令参考: http://www.cnblogs.com/softwaretesting/archive/2011/07/12/2104435.html [1]解压文件格式的区别: *.tar  ...

  9. python 包管理工具

    python 包管理工具 Python当前的包管理工具链是 easy_install/pip + distribute/setuptools + distutils,显得较为混乱. 而将来的工具链组合 ...

  10. ASP.NET MVC使用Bootstrap系列(1)——开始使用Bootstrap

    阅读目录 Bootstrap结构介绍 在ASP.NET MVC 项目中添加Bootstrap文件 为网站创建Layout布局页 使用捆绑打包和压缩来提升网站性能 在Bootstrap项目中使用捆绑打包 ...