首页 > 其他 > 详细

12th浙江省省赛 J Convert QWERTY to Dvorak(细节模拟题)

时间:2015-04-25 21:12:45      阅读:337      评论:0      收藏:0      [点我收藏+]
Convert QWERTY to Dvorak

Time Limit: 2 Seconds      Memory Limit: 65536 KB

Edward, a poor copy typist, is a user of the Dvorak Layout.But now he has only a QWERTY Keyboard with a brokenCaps Lockkey, so Edward never presses the brokenCaps Lockkey.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;
听说gets 快要不能用了 好伤心 T T 新的getline慢得要死
#include <bits/stdc++.h>
using namespace std;
char cha(char c)
{
    char a;
    switch(c)
    {
        case 'q':a='\'';break;
        case 'w':a=',';break;
        case 'e':a='.';break;
        case 'r':a='p';break;
        case 't':a='y';break;
        case 'y':a='f';break;
        case 'u':a='g';break;
        case 'i':a='c';break;
        case 'o':a='r';break;
        case 'p':a='l';break;
        case '[':a='/';break;
        case ']':a='=';break;
        case 's':a='o';break;
        case 'd':a='e';break;
        case 'f':a='u';break;
        case 'g':a='i';break;
        case 'h':a='d';break;
        case 'j':a='h';break;
        case 'k':a='t';break;
        case 'l':a='n';break;
        case ';':a='s';break;
        case '\'':a='-';break;
        case 'z':a=';';break;
        case 'x':a='q';break;
        case 'c':a='j';break;
        case 'v':a='k';break;
        case 'b':a='x';break;
        case 'n':a='b';break;
        case 'm':a='m';break;
        case ',':a='w';break;
        case '.':a='v';break;
        case '/':a='z';break;
        case 'Q':a='"';break;
        case 'W':a='<';break;
        case 'E':a='>';break;
        case 'R':a='P';break;
        case 'T':a='Y';break;
        case 'Y':a='F';break;
        case 'U':a='G';break;
        case 'I':a='C';break;
        case 'O':a='R';break;
        case 'P':a='L';break;
        case '{':a='?';break;
        case '}':a='+';break;
        case 'S':a='O';break;
        case 'D':a='E';break;
        case 'F':a='U';break;
        case 'G':a='I';break;
        case 'H':a='D';break;
        case 'J':a='H';break;
        case 'K':a='T';break;
        case 'L':a='N';break;
        case ':':a='S';break;
        case '"':a='_';break;
        case 'Z':a=':';break;
        case 'X':a='Q';break;
        case 'C':a='J';break;
        case 'V':a='K';break;
        case 'B':a='X';break;
        case 'N':a='B';break;
        case 'M':a='M';break;
        case '<':a='W';break;
        case '>':a='V';break;
        case '?':a='Z';break;
        case '-':a='[';break;
        case '_':a='{';break;
        case '=':a=']';break;
        case '+':a='}';break;
        default:a=c;
    }
    return a;
}
char s[1000000];
int main()
{
    //freopen("a.txt","r",stdin);
    //freopen("b.txt","w",stdout);
    while(gets(s))
    {
        int l=strlen(s);
        for(int i=0;i<l;i++)
        {
            char c=cha(s[i]);
            cout<<c;
        }
        puts("");
    }
    return 0;
}

 

12th浙江省省赛 J Convert QWERTY to Dvorak(细节模拟题)

原文:http://blog.csdn.net/u012349696/article/details/45273981

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!