zoj3878 Convert QWERTY to Dvorak(字符串)
2016-03-08 14:53
471 查看
这题让我一脸懵逼了好久,好久不做字符串都不会处理了,现在若是比赛我还真不一定能做出来= =。
刚开始不知道"字符串中表示前面要加\,编译一直通不过。。。
然后编译出来字符不对,原来是忘了加break,还以为表打错了看了好久。。。
最后发现连换行都忘了,真失败啊。。。
刚开始不知道"字符串中表示前面要加\,编译一直通不过。。。
然后编译出来字符不对,原来是忘了加break,还以为表打错了看了好久。。。
最后发现连换行都忘了,真失败啊。。。
#include <stdio.h> #include <algorithm> #include <iostream> #include <queue> #include <string.h> using namespace std; const int N = 500; const int INF = 1000000; char a1[] = {"-=qwertyuiop[]asdfghjkl;'zxcvbnm,./_+QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>?"}; char a2[] = {"[]',.pyfgcrl/=aoeuidhtns-;qjkxbmwvz{}\"<>PYFGCRL?+AOEUIDHTNS_:QJKXBMWVZ"}; int main() { // freopen("in.txt", "r", stdin); char a; int i; while(~scanf("%c", &a)) { if(a == '\n') printf("\n"); else { int len = strlen(a1); for(i = 0; i < len; i ++) { if(a == a1[i]) { a = a2[i]; break; } } printf("%c", a); } } return 0; }
相关文章推荐
- zoj3549 快速幂
- ZOJ 1002
- ZOJ-3861 DFS+回溯
- ZOJ3279 —— 8G island
- zoj_1004-Anagrams by stack
- zoj_2278-Fight for Food
- ZOJ 1001 A+B Problem
- zoj 2710 Two Pipelines
- zoj 386 4000 1 Valid Pattern Lock
- ZOJ 3755 Mines 回溯+剪枝
- ZOJ3750 Dot Dot Dot 枚举状态+BFS
- poj 1514&zoj 1185 Metal Cutting(半平面交)
- ZOJ1101-Gamblers 终于AC。。。
- zoj 1148 The Game 一个晚上终于AC!
- zoj 3420 纯bfs
- PAT 01-复杂度2. Maximum Subsequence Sum (25)&&PAT 01-复杂度1. 最大子列和问题(20)
- 狗狗40题~ (Volume A)
- 狗狗40题~ (Volume B)
- 狗狗40题~ (Volume C)
- ZOJ3319 DP 通过入度出度判非法情况