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.

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;

这个题直接暴力手打了两张表,然后用map进行了映射。

代码:

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <string> using namespace std; char from[100] =
{
'~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+',
'`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=',
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', '|',
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\\',
'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"',
'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'',
'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?',
'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', ' '
};
char to[100] =
{
'~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '{', '}',
'`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '[', ']',
'"', '<', '>', 'P', 'Y', 'F', 'G', 'C', 'R', 'L', '?', '+', '|',
'\'',',', '.', 'p', 'y', 'f', 'g', 'c', 'r', 'l', '/', '=', '\\',
'A', 'O', 'E', 'U', 'I', 'D', 'H', 'T', 'N', 'S', '_',
'a', 'o', 'e', 'u', 'i', 'd', 'h', 't', 'n', 's', '-',
':', 'Q', 'J', 'K', 'X', 'B', 'M', 'W', 'V', 'Z',
';', 'q', 'j', 'k', 'x', 'b', 'm', 'w', 'v', 'z', ' '
}; char str; int main()
{
//freopen("test.in", "r", stdin);
map<char, char> Hash;
for (int i = 0; i < 100; ++i)
Hash[from[i]] = to[i];
while ((str = getchar()) != EOF)
{
if(str == '\n')
printf("\n");
else
printf("%c", Hash[str]);
}
return 0;
}

ACM学习历程—ZOJ3878 Convert QWERTY to Dvorak(Hash && 模拟)的更多相关文章

  1. ACM学习历程——UVA 127 "Accordian" Patience(栈;模拟)

    Description  ``Accordian'' Patience  You are to simulate the playing of games of ``Accordian'' patie ...

  2. zoj The 12th Zhejiang Provincial Collegiate Programming Contest Convert QWERTY to Dvorak

    http://acm.zju.edu.cn/onlinejudge/showContestProblem.do?problemId=5502  The 12th Zhejiang Provincial ...

  3. 模拟 ZOJ 3878 Convert QWERTY to Dvorak

    题目传送门 /* 模拟:手敲map一一映射,累! 除了忘记读入字符串不能用gets用getline外还是很顺利的AC了:) */ #include <cstdio> #include &l ...

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

    Convert QWERTY to Dvorak Time Limit: 2 Seconds      Memory Limit: 65536 KB Edward, a poor copy typis ...

  5. (字符串 键盘转换)Convert QWERTY to Dvorak -- zoj -- 5526

    链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5526 Time Limit: 2 Seconds      Memor ...

  6. Convert QWERTY to Dvorak

      Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Submit Status Pract ...

  7. 完成了C++作业,本博客现在开始全面记录acm学习历程,真正的acm之路,现在开始

    以下以目前遇到题目开始记录,按发布时间排序 ACM之递推递归 ACM之数学题 拓扑排序 ACM之最短路径做题笔记与记录 STL学习笔记不(定期更新) 八皇后问题解题报告

  8. ACM学习历程—HDU 5512 Pagodas(数学)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5512 学习菊苣的博客,只粘链接,不粘题目描述了. 题目大意就是给了初始的集合{a, b},然后取集合里 ...

  9. ACM学习历程—HDU5521 Meeting(图论)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5521 学习菊苣的博客,只粘链接,不粘题目描述了. 题目大意就是一个人从1开始走,一个人从n开始走.让最 ...

随机推荐

  1. nodejs 简单的备份github代码初版

    传送门:http://www.jianshu.com/p/002efed0d3af 我的代码: const https = require('https'); const fs = require(& ...

  2. PHP中的session永不过期的解决思路及实现方法分享

    打开php.ini设置文件,修改三行如下: 1.session.use_cookies  把这个的值设置为1,利用cookie来传递sessionid  2.session.cookie_lifeti ...

  3. go test 上篇

    前言 Go语言本身集成了轻量级的测试框架,由go test命令和testing包组成.包含单元测试和压力测试,是保证我们编写健壮Golang程序的有效工具. 演示环境 $ uname -a Darwi ...

  4. Java 基础系列之volatile变量(一)

    一.锁 两种特性:互斥性(mutual exclusion).可见性(visibility).原子性(atomic) 互斥性就是一次只有一个线程可以访问该共享数据,可见性就是释放锁之前,对共享数据的修 ...

  5. Jquery和JS的区别

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  6. TCP的四种定时器简单记录

    TCP管理的4个不同的定时器: 1.重传定时器:用于当希望收到另一端的确认. 2.坚持定时器:使窗口大小信息保持不断流动. 3.保活定时器:检测TCP空闲连接的另一端何时崩溃或重启. 4.2MSL定时 ...

  7. 使用struts2中默认的拦截器以及自定义拦截器

    转自:http://blog.sina.com.cn/s/blog_82f01d350101echs.html 如何使用struts2拦截器,或者自定义拦截器.特别注意,在使用拦截器的时候,在Acti ...

  8. 怎么使用Aspose.Cells读取excel 转化为Datatable

    说明:vs2012 asp.net mvc4 c# 使用Aspose.Cells 读取Excel 转化为Datatable 1.HTML前端代码 <%@ Page Language=" ...

  9. css多余字符显示省略号

    width:300px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; ;

  10. 双缓冲类里的OnPaint与OnSize,以及构造函数的关系

    代码摘自wx\lib\agw\knobctrl.py一点体会是,OnSize作为class的函数,被放在构造函数里执行,会先于OnPaint执行.测试结果是,初始启动后,会执行8次OnSize(为什么 ...