Codeforces 474 A
来源:互联网 发布:js选中form 编辑:程序博客网 时间:2024/04/30 00:40
click here ~~
***A. 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:qwertyuiopasdfghjkl;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.InputFirst 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.OutputPrint a line that contains the original message.Sample test(s)inputRs;;upimrrfod;pbroutputallyouneedislove
题目大意:就是给你一个字符串,让你向右或向左移动一位
直接上代码吧,太水了。。。
/*2015 - 8 - 29 中午Author: ITAK今日的我要超越昨日的我,明日的我要胜过今日的我,以创作出更好的代码为目标,不断地超越自己。*/#include <iostream>#include <cstring>using namespace std;char str[105];char st[105];char s[31] = {"qwertyuiopasdfghjkl;zxcvbnm,./"};int main(){ char c; while(cin>>c) { cin>>str; int len = strlen(str); if(c == 'R') { for(int i=0; i<len; i++) { for(int j=0; j<30; j++) { if(str[i] == s[j]) { cout<<s[j-1]; break; } } } } else { for(int i=0; i<len; i++) { for(int j=0; j<30; j++) { if(str[i] == s[j]) { cout<<s[j+1]; break; } } } } } return 0;}
0 0
- Codeforces 474 A
- CodeForces 474A Keyboard
- codeforces 474A Keyboard
- Codeforces 474A Keyboard (水
- codeforces Round #474--A.Keyboard
- CodeForces-a
- Codeforces 903A A
- Codeforces 474A (五一训练 J)+
- CodeForces 18A A - Triangle
- CodeForces 133A A. HQ9+
- codeforces 651A A. Joysticks
- 【Codeforces 597A】A. Divisibility
- 【 Codeforces 615A】A. Bulbs
- A. Divisibility CodeForces 597A
- codeforces 417A A. Elimination
- CodeForces 534A A. Exam
- codeforces#98 a
- codeforces#99 a
- Android调用微信登陆、分享、支付
- 百度编辑器Ueditor的黑白名单过滤
- 平板电脑TELEC(MIC)认证中WIFI第十四信道测试方法
- cocos2dx场景A跳转到场景B,然后场景B再向A回传值(委托设计模式实现)。
- 有些事做起来比想象中容易
- Codeforces 474 A
- 使用Jsoup消除不受信任的HTML (来防止XSS攻击)
- Android在线切换主题(换肤),支持直接替换整个布局
- HDU 2570 迷瘴(贪心 过程处理不好会导致精度问题)
- range 和xrange
- 自定义ViewPager实现轮播效果
- ZOJ3811--Untrusted Patrol(DFS)
- 跨站脚本攻击-----为什么要过滤危险字符串
- Ember启动报错