QUST'S OJ problem 1641错位的键盘
来源:互联网 发布:ubuntu samba权限设置 编辑:程序博客网 时间:2024/06/05 04:13
错位的键盘
时间限制: 1 Sec 内存限制: 128 MB题目描述
A common typing error is to place the hands on the keyboard one row to the right of the correct position. So "Q" is typed as "W" and "J" is typed as "K" and so on. You are to decode a message typed in this manner.
输入
Input consists of several lines of text. Each line may contain digits, spaces, upper case letters (except Q, A, Z), or punctuation shown above [except back-quote (`)]. Keys labelled with words [Tab, BackSp, Control, etc.] are not represented in the input.
输出
You are to replace each letter or punctuation symbol by the one immediately to its left on the QWERTY keyboard shown above. Spaces in the input should be echoed in the output.
样例输入
O S, GOMR YPFSU/
样例输出
I AM FINE TODAY.
点击打开链接
把所有的字符按键盘排列从左到右保存在数组中,当输入字符为非空格时找到这个元素的数组下标,输出该元素的前一位;否则,原样输出空格;往复循环,直至文件结束。
<span style="font-size:18px;">#include<cstdio>#include<string.h>using namespace std;int main(){ int i,c ; char s[]="`1234567890-=QWERTYUIOP[]\ASDFGHJKL;'ZXCVBNM,./"; while((c=getchar())!=EOF) { for(i=1;s[i]&&c!=s[i];i++); //“;”找到符合条件的元素的位置 if(s[i])<span style="white-space:pre"></span>//空格原样输出 putchar (s[i-1]); else putchar (c); }<span style="white-space:pre"></span>return 0;}</span>
0 0
- QUST'S OJ problem 1641错位的键盘
- QUST'S-OJ-problem-1262hanoi1.0
- QUST'S OJ problem 1781 分数线划定
- QUST'S OJ problem 1779 统计数字
- QUST'S OJ problem 1778奖学金
- QUST'S OJ problem 1355 函数实现二维数组的行列转换
- QUST'S OJ problem 1002 谁拿了最多奖学金
- QUST'S OJ problem1780 接水问题
- QUST'S OJ problem1342 完数
- 【OJ】QUST 1418
- 【OJ】QUST 1400
- 【OJ】QUST 1419
- 【OJ】QUST 1405
- 【OJ】QUST 1401
- 【OJ】QUST 1226
- 【OJ】QUST 1227
- 【OJ】QUST 1228
- 【OJ】QUST 1229
- RecycleView添加分割线。
- ASCII,UNICODE与UTF-8
- 原生JS中如何获取CSS属性中的值
- kibana 报错 nested: FacetPhaseExecutionException Parse Failure [Failed to parse source
- 解决“Unable to find vcvarsall.bat”错误
- QUST'S OJ problem 1641错位的键盘
- HAProxy安装及配置
- maven手册篇
- UVA 11021 Tribbles【概率】
- Android Fragment 你应该知道的一切
- 自定义Dockerfile创建tomcat镜像
- js中typeof和instanceof用法区别
- 利用defineProperty实现数据的双向绑定
- BP神经网络模型与学习算法