您的位置:首页 > 其它

zoj--3878--Convert QWERTY to Dvorak(纯暴力)

2016-05-03 17:13 507 查看
Convert QWERTY to DvorakTime Limit: 2 Seconds      Memory Limit: 65536 KBEdward, a poor copy typist, is a user of the Dvorak Layout. But now he has only a QWERTY Keyboard with a broken CapsLock 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.

Output

The Dvorak document.

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

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;
队友让我见识了暴力最终奥义
数组要开大一点,后台数据比较长
#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;}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: