結果

問題 No.303 割れません
ユーザー maine_honzukimaine_honzuki
提出日時 2021-05-14 19:09:02
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 445 bytes
コンパイル時間 395 ms
コンパイル使用メモリ 82,520 KB
実行使用メモリ 148,164 KB
最終ジャッジ日時 2024-04-09 22:19:40
合計ジャッジ時間 12,492 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
53,552 KB
testcase_01 AC 31 ms
53,544 KB
testcase_02 AC 32 ms
52,888 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 WA -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def maine(L):
    if L <= 2:
        return 1
    L -= 2
    a,b,c,d,maine,book = 1,1,1,0,1,1
    while L > 0:
        if L%2 == 1:
            maine,book = a*maine+b*book, c*maine+d*book
        a,b,c,d = a**2+b*c, b*(a+d), c*(a+d), b*c+d**2
        L //= 2
    return maine

L = int(input())
if L==2:
    print("INF")
    print(0)
else:
    print(L)
    if L&1 == 1: 
        print(maine(L))
    else:
        print(maine(L) - maine(L//2)**2)
0