博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[结题报告]10082 - WERTYU Time limit: 3.000 seconds
阅读量:7220 次
发布时间:2019-06-29

本文共 2399 字,大约阅读时间需要 7 分钟。

Problem C: WERTYU

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 punction symbol by the one immediately to its left on the QWERTY keyboard shown above. Spaces in the input should be echoed in the output.

Sample Input

O S, GOMR YPFSU/

Output for Sample Input

I AM FINE TODAY. 参考代码: 把字符换成键盘的左边一个字符(最左边的,回车的控制键无效),不多说,上代码..
#include
int main() { char a; while(scanf("%c",&a)!=EOF) {
if(a=='=') printf("-"); else if(a=='-')printf("0"); else if(a=='0')printf("9"); else if(a=='9')printf("8"); else if(a=='8')printf("7"); else if(a=='7')printf("6"); else if(a=='6')printf("5"); else if(a=='5')printf("4"); else if(a=='4')printf("3"); else if(a=='3')printf("2"); else if(a=='2')printf("1"); else if(a=='1')printf("`"); else if(a=='\\')printf("]"); else if(a==']')printf("["); else if(a=='[')printf("P"); else if(a=='P')printf("O"); else if(a=='O')printf("I"); else if(a=='I')printf("U"); else if(a=='U')printf("Y"); else if(a=='Y')printf("T"); else if(a=='T')printf("R"); else if(a=='R')printf("E"); else if(a=='E')printf("W"); else if(a=='W')printf("Q"); else if(a=='\'')printf(";"); else if(a==';')printf("L"); else if(a=='L')printf("K"); else if(a=='K')printf("J"); else if(a=='J')printf("H"); else if(a=='H')printf("G"); else if(a=='G')printf("F"); else if(a=='F')printf("D"); else if(a=='D')printf("S"); else if(a=='S')printf("A"); else if(a=='/')printf("."); else if(a=='.')printf(","); else if(a==',')printf("M"); else if(a=='M')printf("N"); else if(a=='N')printf("B"); else if(a=='B')printf("V"); else if(a=='V')printf("C"); else if(a=='C')printf("X"); else if(a=='X')printf("Z"); else printf("%c",a); } return 0; }

 

转载于:https://www.cnblogs.com/sjy123/archive/2013/02/21/2919972.html

你可能感兴趣的文章
ORACLE EXPIRED(GRACE)
查看>>
Markdown应用样例
查看>>
多文本框的值得存放和赋值
查看>>
Linux中计划任务执行脚本crontab-简洁版
查看>>
Java - IO
查看>>
安卓app中嵌入一个H5页面,当手机系统设置字体变大时,如何使H5页面的字体不会随用户自己调整的系统字体变化而变化?...
查看>>
safari 收藏导出 手机safari 导出
查看>>
Dalvik 虚拟机 jvm 区别
查看>>
hexo从零开始
查看>>
币值转换
查看>>
RabbitMQ(六)远程连接
查看>>
得到ios设备的一些信息
查看>>
【教程】如何修改路由表?
查看>>
云计算与虚拟化之后:网络威胁成新挑战
查看>>
50个Demo展示HTML5无穷的魅力
查看>>
chapter 4:贪心
查看>>
批处理学习笔记
查看>>
Linux挂载磁盘
查看>>
Cyclone II RAM ROM设置
查看>>
Ubuntu下实现伪静态
查看>>