实验吧 围在栅栏中的爱

实验吧 围在栅栏中的爱

题目链接:http://www.shiyanbar.com/ctf/1917

题目大意:最近一直在好奇一个问题,QWE到底等不等于ABC?-.- .. --.- .-.. .-- - ..-. -.-. --.- --. -. ... --- ---

摩斯密码+QWE加密+栅栏密码

首先很明显后面那串是摩斯密码,在线摩斯密码解密得"KIQLWTFCQGNSOO".

由题目中的提示信息猜测是QWE加密(以标准键盘的字母顺序映射'A'-'Z'的字母),解密翻转后得"IILYOAVNEBSAHR".

字符串中包含'L','O','V','E'与题目中的'爱'字呼应,由题目"栅栏"得知是栅栏加密.

以2个字符为1栏,排列成7*2的矩阵,得到flag:"iloveshiyanbar"(答案要小写).

QWE解密及翻转的代码如下:

 1 #include <iostream>
 2 #include <string>
 3 #include <cstdio>
 4 #include <algorithm>
 5 #define N 10005
 6 using namespace std;
 7 typedef long long ll;
 8 char f[]={'Q','W','E','R','T','Y','U','I','O','P','A','S','D','F','G','H','J','K','L','Z','X','C','V','B','N','M'};
 9 char g[27];
10 string s,t="";
11 int main(void){
12     freopen("in.txt","r",stdin);
13     freopen("out.txt","w",stdout);
14     for(int i=0;i<26;++i)
15         g[f[i]-'A']=i+'A';
16     cin>>s;
17     for(int i=0;i<s.length();++i)
18         t+=g[s[i]-'A'];
19     reverse(t.begin(),t.end());
20     cout<<t;
21 }
原文地址:https://www.cnblogs.com/barrier/p/6732782.html