Codeforces 271 Div 2 A Keyboard
题目链接: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的更多相关文章
- Codeforces Round #271 (Div. 2)-A. Keyboard
http://codeforces.com/problemset/problem/474/A A. Keyboard time limit per test 2 seconds memory limi ...
- Codeforces 271 Div 2 C. Captain Marmot
题目链接:http://codeforces.com/contest/474/problem/C 解题报告:给一个n,然后输入4*n个平面坐标系上的点,每四个点是一组,每个点有一个中心,这四个点可以分 ...
- Codeforces 271 Div 2 B. Worms
题目链接:http://codeforces.com/contest/474/problem/B 解题报告:给你n个堆,第i个堆有ai个物品,物品的编号从1开始,第一堆的编号从1到a1,第二堆编号从a ...
- codeforces#271 (Div. 2)预处理
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 #344 Div.2
Codeforces #344 Div.2 Interview 题目描述:求两个序列的子序列或操作的和的最大值 solution 签到题 时间复杂度:\(O(n^2)\) Print Check 题目 ...
- Codeforces #345 Div.1
Codeforces #345 Div.1 打CF有助于提高做题的正确率. Watchmen 题目描述:求欧拉距离等于曼哈顿距离的点对个数. solution 签到题,其实就是求有多少对点在同一行或同 ...
- Codeforces Beta Round #27 (Codeforces format, Div. 2)
Codeforces Beta Round #27 (Codeforces format, Div. 2) http://codeforces.com/contest/27 A #include< ...
- Codeforces#441 Div.2 四小题
Codeforces#441 Div.2 四小题 链接 A. Trip For Meal 小熊维尼喜欢吃蜂蜜.他每天要在朋友家享用N次蜂蜜 , 朋友A到B家的距离是 a ,A到C家的距离是b ,B到C ...
随机推荐
- WinForm------TextEdit控件去掉换行符
//将换行转为空格 string str = this.DetailEdit.Text.Replace("\r\n"," ");
- UIView UIwindow
UI:用户界面,用户能看到的各种各样的页面元素 UIview :代表屏幕上的一个矩形区域,管理界面上的内容 创建UIview 1.开辟空间并初始化视图(初始化时,给出视图位置和大小 2.对 ...
- Maven概览
Maven的核心思想,约定由于配置 1 Maven坐标 1.1 本项目的坐标 groupId: 必须.项目组名称,定义当前Maven项目所隶属的实际项目,通常与域名反向一一对应,与Java包名表示方式 ...
- PHP----遇到的Session问题
使用SESSION,当跨页面使用时,会提示错误Cannot modify header information - headers already sent by..., 背景:使用session_s ...
- JavaScript Engines
http://openaphid.github.io/blog/2013/01/17/part-i-how-to-choose-a-javascript-engine-for-ios-and-andr ...
- td:first-child 伪类 匹配第一个 匹配第一个 <td> 元素
css代码: td:first-child{border-right: 1px solid #d9dbdd; } 备注:在下面的例子中,选择器匹配作为任何元素的第一个子元素的 p 元素: 链接:htt ...
- MongoVUE
MongoVUE运行界面如下:
- js字节转换、字节转换GB等
//文件大小换算 function bytesToSize(bytes) { if (bytes === 0) return '0 B'; var k = 1024; sizes = ['B','KB ...
- yii2接收activeform表单信息
第一种方法: $model->load(Yii::$app->request->post()); 第二种方法: 获取具体的某一项的值 $demo = $_POST['模型名']['字 ...
- Redis 资源
一.资源 1.Redis中文网站: http://www.redis.cn/ 2.RedisDesktop http://redisdesktop.com/download