BUUCTF:[INSHack2019]Crunchy

题目来源:https://buuoj.cn/challenges#[INSHack2019]Crunchy

得到两个文件

description没啥用 直接看py文件

直接运行会报错 RecursionError: maximum recursion depth exceeded in comparison(超过最大递归限度)

看不懂要求的啥 遂上网搜wp

贴个大佬代码

n = 17665922529512695488143524113273224470194093921285273353477875204196603230641896039854934719468650093602325707751568
m = 100000007

def getSequencePeriod(m):
    s = []
    s.append(0)
    s.append(1)
    for i in range(2, m*6):
        s.append((6 * s[i-1] + s[i-2]) % m)
        if (s[i] == 1 and s[i-1] == 0):
            break
    return s

def getFibonacciRest(n, m):
    s = getSequencePeriod(m)
    period = len(s) - 2
    val = n % period
    return(s[val])

print(getFibonacciRest(n,m))

得到flag

参考:https://www.bilibili.com/read/cv13950329
posted @ 2022-01-25 16:30  B0mbax  阅读(250)  评论(0)    收藏  举报