ZOJ - 3878 Convert QWERTY to Dvorak (暴力)水&坑
2016-05-01 16:04
423 查看
ZOJ - 3878
Convert QWERTY to Dvorak
SubmitStatus
Description
Edward, a poor copy typist, is a user of the Dvorak Layout. But now he has only a QWERTY Keyboard with a broken
Caps Lock key, so Edward never presses the broken
Caps Lock key. Luckily, all the other keys on the QWERTY keyboard work well. Every day, he has a lot of documents to type. Thus he needs a converter to translate QWERTY into
Dvorak. Can you help him?
The QWERTY Layout and the Dvorak Layout are in the following:
<h4< body="">
Input
A QWERTY document Edward typed. The document has no more than 100 kibibytes. And there are no invalid characters in the document.
<h4< body="">
Output
The Dvorak document.
<h4< body="">
Sample Input
<h4< body="">
Sample Output
Hint
Source
The 12th Zhejiang Provincial Collegiate Programming Contest
//题意:
小明的键盘和我们正常的键盘不同,如上图对应的情况,现在说输入一个字符串,让你输出小明的键盘输出的字符串。
//思路:
水题,直接模拟,但是很坑,题中要求的是输入不超过100K(1K=1024个字符),这块没看清,以为是100个字符,所以就WA了一遍。
Convert QWERTY to Dvorak
Time Limit: 2000MS | Memory Limit: 65536KB | 64bit IO Format: %lld & %llu |
Description
Edward, a poor copy typist, is a user of the Dvorak Layout. But now he has only a QWERTY Keyboard with a broken
Caps Lock key, so Edward never presses the broken
Caps Lock key. Luckily, all the other keys on the QWERTY keyboard work well. Every day, he has a lot of documents to type. Thus he needs a converter to translate QWERTY into
Dvorak. Can you help him?
The QWERTY Layout and the Dvorak Layout are in the following:
The QWERTY Layout |
---|
The Dvorak Layout |
---|
Input
A QWERTY document Edward typed. The document has no more than 100 kibibytes. And there are no invalid characters in the document.
<h4< body="">
Output
The Dvorak document.
<h4< body="">
Sample Input
Jgw Gqm Andpw a H.soav Patsfk f;doe Nfk Gq.d slpt a X,dokt vdtnsaohe Kjd yspps,glu pgld; aod yso kd;kgluZ 1234567890 `~!@#$%^&*()}"']_+-=ZQqWEwe{[\| ANIHDYf.,bt/ ABCDEFuvwxyz
<h4< body="">
Sample Output
Hi, I'm Abel, a Dvorak Layout user. But I've only a Qwerty keyboard. The following lines are for testing: 1234567890 `~!@#$%^&*()+_-={}[]:"'<>,.?/\| ABCDEFuvwxyz AXJE>Ugk,qf;
Hint
Source
The 12th Zhejiang Provincial Collegiate Programming Contest
//题意:
小明的键盘和我们正常的键盘不同,如上图对应的情况,现在说输入一个字符串,让你输出小明的键盘输出的字符串。
//思路:
水题,直接模拟,但是很坑,题中要求的是输入不超过100K(1K=1024个字符),这块没看清,以为是100个字符,所以就WA了一遍。
#include<stdio.h> #include<string.h> #include<algorithm> #include<iostream> using namespace std; char s[10000010]; char c[10000010]; int main() { while(gets(s)!=NULL) { memset(c,'\0',sizeof(c)); int len=strlen(s); for(int i=0;i<len;i++) { if(s[i]=='_') c[i]='{'; else if(s[i]=='-') c[i]='['; else if(s[i]=='+') c[i]='}'; else if(s[i]=='=') c[i]=']'; else if(s[i]=='Q') c[i]='"'; else if(s[i]=='q') c[i]=39; else if(s[i]=='W') c[i]='<'; else if(s[i]=='w') c[i]=','; else if(s[i]=='E') c[i]='>'; else if(s[i]=='e') c[i]='.'; else if(s[i]=='R') c[i]='P'; else if(s[i]=='r') c[i]='p'; else if(s[i]=='T') c[i]='Y'; else if(s[i]=='t') c[i]='y'; else if(s[i]=='Y') c[i]='F'; else if(s[i]=='y') c[i]='f'; else if(s[i]=='U') c[i]='G'; else if(s[i]=='u') c[i]='g'; else if(s[i]=='I') c[i]='C'; else if(s[i]=='i') c[i]='c'; else if(s[i]=='O') c[i]='R'; else if(s[i]=='o') c[i]='r'; else if(s[i]=='P') c[i]='L'; else if(s[i]=='p') c[i]='l'; else if(s[i]=='{') c[i]='?'; else if(s[i]=='[') c[i]='/'; else if(s[i]=='}') c[i]='+'; else if(s[i]==']') c[i]='='; else if(s[i]=='S') c[i]='O'; else if(s[i]=='s') c[i]='o'; else if(s[i]=='D') c[i]='E'; else if(s[i]=='d') c[i]='e'; else if(s[i]=='F') c[i]='U'; else if(s[i]=='f') c[i]='u'; else if(s[i]=='G') c[i]='I'; else if(s[i]=='g') c[i]='i'; else if(s[i]=='H') c[i]='D'; else if(s[i]=='h') c[i]='d'; else if(s[i]=='J') c[i]='H'; else if(s[i]=='j') c[i]='h'; else if(s[i]=='K') c[i]='T'; else if(s[i]=='k') c[i]='t'; else if(s[i]=='L') c[i]='N'; else if(s[i]=='l') c[i]='n'; else if(s[i]==':') c[i]='S'; else if(s[i]==';') c[i]='s'; else if(s[i]=='"') c[i]='_'; else if(s[i]==39) c[i]='-'; else if(s[i]=='Z') c[i]=':'; else if(s[i]=='z') c[i]=';'; else if(s[i]=='X') c[i]='Q'; else if(s[i]=='x') c[i]='q'; else if(s[i]=='C') c[i]='J'; else if(s[i]=='c') c[i]='j'; else if(s[i]=='V') c[i]='K'; else if(s[i]=='v') c[i]='k'; else if(s[i]=='B') c[i]='X'; else if(s[i]=='b') c[i]='x'; else if(s[i]=='N') c[i]='B'; else if(s[i]=='n') c[i]='b'; else if(s[i]=='<') c[i]='W'; else if(s[i]==',') c[i]='w'; else if(s[i]=='>') c[i]='V'; else if(s[i]=='.') c[i]='v'; else if(s[i]=='?') c[i]='Z'; else if(s[i]=='/') c[i]='z'; else c[i]=s[i]; } puts(c); } return 0; }
相关文章推荐
- 移动SDK介绍
- sicily 1047(数学)
- 剑指offer(63):多行打印二叉树
- PHP学习记录第一篇:Ubuntu14.04下LAMP环境的搭建
- 【Leetcode】:337. House Robber III 问题 in JAVA
- hdu2501 简单递推
- 异常 dubbo中provider和consumer加载异常 Zookeeper注册
- POJ 1364 King (差分约束 + spfa (bellman) 判环)
- 机器学习中的隐马尔科夫模型(HMM)详解
- Cloudera Manager 5和CDH5离线安装
- NOIP2004Day1P2合并果子
- 《Java程序设计》第九周学习总结
- Hibernate遇到的几个常见映射异常
- Tomcat和Jsp简单的介绍
- 图片替代方案Data URI
- OC id 类型
- eclipse color theme 主题颜色
- [drp 5] pageModel的建立,实现分页查询
- 关于Java中抽象类和接口区别的总结
- 在Ubuntu上搭建Android开发环境(Android Studio)