實驗吧 圍在柵欄中的愛
題目鏈接: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 }