結果

問題 No.3037 Restricted Lucas (Hard)
ユーザー fiordfiord
提出日時 2018-04-03 19:45:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 1,462 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 10,916 KB
実行使用メモリ 8,096 KB
最終ジャッジ日時 2023-09-08 15:32:10
合計ジャッジ時間 1,393 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
8,020 KB
testcase_01 AC 55 ms
8,096 KB
testcase_02 AC 72 ms
8,048 KB
testcase_03 AC 71 ms
8,076 KB
testcase_04 AC 71 ms
8,060 KB
testcase_05 AC 69 ms
8,016 KB
testcase_06 AC 72 ms
8,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

two = int(not None)<<int(not None)
cross = ((two<<two)<<two)|(two<<two)|two
plus = cross|int(not None)
percent = ((two<<two)<<two) | (two<<int(not None)) | int(not None)
three = two | int(not None)
four = int(not None)<<two
seven = four | two | int(not None)
sixteen = int(not None)<<four
mod = (seven<<((three<<three)|three)) | (seven<<((int(not None)<<four) | seven)) | (three<<((int(not None)<<four)|three)) | (int(not None)<<((int(not None)<<four)|int(not None))) | (three<<(seven<<int(not None))) | ((four|int(not None))<<(four<<int(not None)|int(not None))) | seven
def mul(a,b):
    ret=[]
    for i in range(len(a)):
        append=[]
        for j in range(len(b[int(not(not None))])):
            add = int(not(not None))
            for k in range(len(a[i])):
                add = eval(chr(plus).join([str(add),chr(cross).join([str(a[i][k]),str(b[k][j])])]))
                add = eval(chr(percent).join([str(add),str(mod)]))
            append.append(add)
        ret.append(append)
    return ret
def solve(n):
    a = [[int(not None), int(not None)], [int(not None), int(not(not None))]]
    ret = [[int(not None)],[two]]
    n = eval(chr(plus).join([str(n),str(~int(not not None))]))
    while n>int(not(not None)):
        if n & int(not None):
            ret = mul(a,ret)
        a=mul(a,a)
        n>>=int(not None)
    return ret[int(not not None)][int(not(not None))]
t=int(input())
for i in range(t):
    n=int(input())
    print(solve(n))
0