先运行一遍,我猜测就是对I{_}Af2700ih_secTS2Et_wr这一行代码进行正确的排序就寻找到正确的flag了,第一二种都不对,我猜测是第三种。
分析伪代码:
进入init函数里面
调试至第34行时,从头至尾点开qword_xxx,会看到flag。
以上是我的思路,但是看到大佬写的wp才知道考得是数据结构中的二叉树的遍历
其中type1和type2分别是中序遍历和后序遍历。
参考代码:已知中序后序求前序,然后改一下代码:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
char post[] = "20f0Th{2tsIS_icArE}e7__w"; //后序遍历结果
char mid[] = "2f0t02T{hcsiI_SwA__r7Ee}"; //中序遍历结果
void pre(int root,int start,int end)
{
if(start > end)
return ;
int i = start;
while(i < end && mid[i] != post[root])
i++; //定位根在中序的位置
printf("%c",mid[i]);
pre(root - 1-(end - i),start,i - 1); //递归处理左子树
pre(root-1,i + 1,end); //递归处理右子树
}
int main()
{
pre(24,0,24);//24为flag的位数
return 0;
}
即可求出wctf2020{This_IS_A_7reE}