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

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
`[email protected]#$%^&*()}"‘]_+-=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
`[email protected]#$%^&*()+_-={}[]:"‘<>,.?/\|
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;
}


时间: 2024-10-22 12:20:27

12th浙江省省赛 J Convert QWERTY to Dvorak(细节模拟题)的相关文章

J - Convert QWERTY to Dvorak——ZOJ

J - Convert QWERTY to Dvorak Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Submit Status 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 Loc

模拟 ZOJ 3878 Convert QWERTY to Dvorak

题目传送门 1 /* 2 模拟:手敲map一一映射,累! 3 除了忘记读入字符串不能用gets用getline外还是很顺利的AC了:) 4 */ 5 #include <cstdio> 6 #include <iostream> 7 #include <algorithm> 8 #include <cmath> 9 #include <cstring> 10 #include <string> 11 #include <map&

zoj 3878 Convert QWERTY to Dvorak【好坑的模拟】

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 broken Caps Lock key, so Edward never presses the broken Caps Lock key

ZOJ 3878-Convert QWERTY to Dvorak【模拟】

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 broken Caps Lock key, so Edward never presses the broken Caps Lock key

Convert QWERTY to Dvorak

Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Submit Status Practice ZOJ 3878 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 E

ACM学习历程—ZOJ3878 Convert QWERTY to Dvorak(Hash &amp;&amp; 模拟)

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.

12th浙江省省赛 H May Day Holiday

May Day Holiday Time Limit: 2 Seconds      Memory Limit: 65536 KB As a university advocating self-learning and work-rest balance, Marjar University has so many days of rest, including holidays and weekends. Each weekend, which consists of Saturday an

12th浙江省省赛 B题 Beauty of Array

Beauty of Array Time Limit: 2 Seconds      Memory Limit: 65536 KB Edward has an array A with N integers. He defines the beauty of an array as the summation of all distinct integers in the array. Now Edward wants to know the summation of the beauty of

OJ Problem Set - 3878 Convert QWERTY to Dvorak

题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3878 1 /* 2 问题 3 很有意思的一道题目,纯模拟,注意细节和最后一行的空格就行了 4 */ 5 6 #include<iostream> 7 #include<string> 8 #include<map> 9 using namespace std; 10 11 int main() 12 { 13 map<char,