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. 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;
解题思路:
	直接模拟就行。
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
char map[2000005];
char xx[]={"-=_+qwertyuiop[]QWERTYUIOP{}asdfghjkl;'ASDFGHJKL:\"zxcvbnm,./ZXCVBNM<>?"};
char yy[]={"[]{}',.pyfgcrl/=\"<>PYFGCRL?+aoeuidhtns-AOEUIDHTNS_;qjkxbmwvz:QJKXBMWVZ"};
int main()
{
	while(gets(map)!=NULL)
	{
		int j;
		int len=strlen(map);
		for(int i=0;i<len;i++)
		{
			j=0;
			bool cc=0;
			while(xx[j])
			{
				if(xx[j]==map[i])
				{
					cc=1;
					printf("%c",yy[j]);
					break;
				}
				else
				{
					j++;
				}
			}
			if(cc==0)
			printf("%c",map[i]);
		}
		printf("\n");
	}
	return 0;
}

时间: 2024-11-02 22:02:06

ZOJ 3878-Convert QWERTY to Dvorak【模拟】的相关文章

模拟 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

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,

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.Luck

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

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.

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

ZOJ 3804 YY&#39;s Minions (简单模拟)

1 /* 2 题意:一个矩阵中有 n*m个宠物,每一个宠物都有一个状态, 1醒着的,0睡着的 3 X离开的!如果这个宠物(醒着的)的周围醒着的个数>3 || <2它就会睡着, 4 如果这个宠物(睡着的)的周围醒着的个数==3就会醒来! 5 每一分钟都会有变换一个状态! 6 其中会有些宠物会在给定的时间内离开! 7 */ 8 #include<iostream> 9 #include<cstring> 10 #include<cstdio> 11 #inclu

ZOJ 3654 Letty&#39;s Math Class 模拟 难度:0

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4844 题意:给你一个只包含中括号和正整数,+,-,结果在longlong范围内的公式和两个备选答案, 如果答案中有9,第一个是9选A,否则选B 否则,如果第一个是正确答案,输出B,否则输出A #include <cstdio> #include <iostream> #include <cstring> #include <cctype>