不依赖数组(字符串版)
来源:互联网 发布:ios存储数据的方式 编辑:程序博客网 时间:2024/06/05 18:08
同样是不依赖于数组,逐个输入字符,逐个进行操作
Edward, a poor copy typist, is a user of the Dvorak Layout. But now he has only a QWERTY Keyboard with a brokenCaps Lock key, so Edward never presses the brokenCaps 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:
A QWERTY document Edward typed. The document has no more than 100 kibibytes. And there are no invalid characters in the document.
The Dvorak document.
Jgw Gqm Andpw a H.soav Patsfk f;doeNfk Gq.d slpt a X,dokt vdtnsaoheKjd yspps,glu pgld; aod yso kd;kgluZ1234567890`~!@#$%^&*()}"']_+-=ZQqWEwe{[\|ANIHDYf.,bt/ABCDEFuvwxyz
Hi, I'm Abel, a Dvorak Layout user.But I've only a Qwerty keyboard.The following lines are for testing:1234567890`~!@#$%^&*()+_-={}[]:"'<>,.?/\|ABCDEFuvwxyzAXJE>Ugk,qf;
题目大意:如果用上面键盘输入一串字符,就按照下面的键盘顺序把这串字符输出出来;用下面的键盘输入一串字符同理
#include <iostream> #include <stdio.h> #include <string.h> #include <stack> #include <queue> #include <map> #include <set> #include <vector> #include <math.h> #include <algorithm> using namespace std; #define ls 2*i #define rs 2*i+1 #define up(i,x,y) for(i=x;i<=y;i++) #define down(i,x,y) for(i=x;i>=y;i--) #define mem(a,x) memset(a,x,sizeof(a)) #define w(a) while(a) #define LL long long const double pi = acos(-1.0); #define Len 20005 #define mod 19999997 const int INF = 0x3f3f3f3f; char s1[]= {"-=_+qwertyuiop[]QWERTYUIOP{}asdfghjkl;'ASDFGHJKL:\"zxcvbnm,./ZXCVBNM<>?"}; char s2[]= {"[]{}',.pyfgcrl/=\"<>PYFGCRL?+aoeuidhtns-AOEUIDHTNS_;qjkxbmwvz:QJKXBMWVZ"}; char c; char print(char c) { for(int i=0; s1[i]; i++) if(s1[i]==c) return s2[i]; return c; } int main() { w(~scanf("%c",&c)) printf("%c",print(c)); return 0; }
阅读全文
0 0
- 不依赖数组(字符串版)
- 不依赖数组 论述
- 不依赖java的:String.split方法分割字符串
- 字符串数组
- 数组、字符串
- 字符串数组
- 字符串数组
- 字符串数组
- 字符串数组
- 字符串数组
- 字符串数组
- 字符串数组
- 字符串数组
- 数组、字符串
- 数组,字符串
- 字符串数组
- 字符串,数组
- 字符串数组
- Java IO流
- SQL Server数据库备份还原时,提示“数据库正在使用”的解决办法
- tomcat的session冲突
- SPOJ QTREEQuery on a tree(树链剖分-点更新-区间最值查询-入边)
- 关于“keyup”的使用
- 不依赖数组(字符串版)
- ApplicationContext 、WebApplicationContext、ContextLoaderListener
- 【LeetCode】575. Distribute Candies
- 剑指offer-二叉树的深度
- C# 装箱,拆箱,向上转型,向下转型
- Terrible Sets POJ
- redis的安装
- 把 SOAP 服务转化为 REST 服务(REST Service 的最佳实践,第 3 部分)
- SpringBoot和Jpa相关