結果

問題 No.303 割れません
ユーザー maine_honzukimaine_honzuki
提出日時 2021-05-14 19:10:59
言語 PyPy3
(7.3.15)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 445 bytes
コンパイル時間 140 ms
コンパイル使用メモリ 82,360 KB
実行使用メモリ 148,112 KB
最終ジャッジ日時 2024-04-09 22:21:04
合計ジャッジ時間 14,046 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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(3)
    print("INF")
else:
    print(L)
    if L&1 == 1: 
        print(maine(L))
    else:
        print(maine(L) - maine(L//2)**2)
0