結果

問題 No.320 眠れない夜に
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-06-16 05:26:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 345 bytes
コンパイル時間 334 ms
コンパイル使用メモリ 86,836 KB
実行使用メモリ 75,660 KB
最終ジャッジ日時 2023-09-06 06:04:23
合計ジャッジ時間 4,605 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,440 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 69 ms
75,568 KB
testcase_04 WA -
testcase_05 AC 65 ms
71,440 KB
testcase_06 AC 64 ms
71,308 KB
testcase_07 AC 64 ms
71,052 KB
testcase_08 AC 66 ms
71,340 KB
testcase_09 AC 63 ms
71,336 KB
testcase_10 AC 65 ms
71,344 KB
testcase_11 AC 67 ms
75,560 KB
testcase_12 AC 64 ms
71,372 KB
testcase_13 AC 66 ms
71,044 KB
testcase_14 AC 66 ms
71,068 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 64 ms
71,204 KB
testcase_19 AC 65 ms
71,504 KB
testcase_20 AC 66 ms
71,508 KB
testcase_21 AC 68 ms
71,412 KB
testcase_22 AC 63 ms
71,488 KB
testcase_23 WA -
testcase_24 AC 65 ms
71,480 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 65 ms
71,556 KB
testcase_29 AC 67 ms
71,204 KB
testcase_30 WA -
testcase_31 AC 68 ms
71,044 KB
testcase_32 AC 67 ms
71,460 KB
testcase_33 AC 66 ms
71,560 KB
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())

diff = 0
mem = [-1]*(N+1)
mem[1]=1
mem[2]=1
def f(n):
    if mem[n]!=-1:
        return mem[n]
    
    mem[n] = f(n-1)+f(n-2)
    return mem[n]

diff = f(N)-M

ans = 0
while diff>0:
    
    now = 1
    while f(now) <= diff:
        now += 1
    
    now -= 1
    ans += 1
    diff -= f(now)
print(ans)
    
    
0