# 逆向----BugkuCTF----Mountain climbing----笔记

4 篇文章 0 订阅

if ( j_strlen(Str) == 19 )可以得出 输入字符串是19的长度。

while ( v4 < 19 )和 ++v4; 这两行 可以看出来 整个while目的在遍历输入的字符串，

76为L ，82为R

	srand(0xCu);
for (int i = 1; i <= 20; ++i)
{
for (int j = 1; j <= i; ++j)
arr[100 * i + j] = rand() % 100000;
}

for (int i = 1; i <= 20; ++i)
{
for (int j = 1; j <= i; ++j)
printf("%5d ", arr[100 * i + j]);
cout << endl;
}



int func(int NowRow, int NowList, bool direction)
{
int sumA = 0;
int sumB = 0;

if (NowRow >= maxRow)
{
if (NowList >= maxList)
{
//越界抛弃该结果
return 0;
}

return arr[NowRow*100+ NowList];
}

if (direction)
{
//如果是true为只+行
sumA += func(1 + NowRow, NowList, true);
sumB += func(1 + NowRow, NowList, false);
}
else
{
//如果是false为++行列
sumA += func(1 + NowRow, 1 + NowList, true);
sumB += func(1 + NowRow, 1 + NowList, false);
}

int res = sumA>sumB ? sumA : sumB;
return res += arr[NowRow*100+NowList];
}


true为L false为R

	int res = func(2, 2, true);
cout << res << endl;
res = func(2, 2, false);
cout << res << endl;

int hang = 2;
int lie = 2;
int sum = 0;

for (int i = 1; i < 20; i++)
{

int resA = func(hang, lie, true);
int resB = func(hang, lie, false);

if (resA > resB)
{
sum += arr[hang * 100 + lie];
cout << hang << "," << lie <<" true " << arr[hang*100+lie]<<endl;
hang++;
}
else
{
sum += arr[hang * 100 + lie];
cout << hang << "," << lie << " false " << arr[hang * 100 + lie] << endl;
hang++;
lie++;
}

}
cout << sum << endl;



RRRRR LLRRR LRLRR RLRL

3.别以为结束了

od载入动态看一下

LLLLLLLLLLLLLLLLLLL
LHLHLHLHLHLHLHLHLHL

RRRRRRRRRRRRRRRRRRR
RVRVRVRVRVRVRVRVRVR

RRRRR LLRRR LRLRR RLRL

RVRVRHLVRVLVLVRVLVL

• 0
点赞
• 1
收藏
觉得还不错? 一键收藏
• 0
评论
03-12 5843
03-06 205
12-14 1415
05-26 649
06-27 153
06-17 486
11-07 7254
10-29 1万+
08-23 666
12-27 1万+

### “相关推荐”对你有帮助么？

• 非常没帮助
• 没帮助
• 一般
• 有帮助
• 非常有帮助

1.余额是钱包充值的虚拟货币，按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载，可以购买VIP、付费专栏及课程。