結果

問題 No.320 眠れない夜に
ユーザー ckawatakckawatak
提出日時 2019-04-30 13:43:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 463 bytes
コンパイル時間 250 ms
コンパイル使用メモリ 87,348 KB
実行使用メモリ 71,708 KB
最終ジャッジ日時 2023-08-28 16:39:45
合計ジャッジ時間 4,180 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,444 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 70 ms
71,144 KB
testcase_04 WA -
testcase_05 AC 69 ms
71,640 KB
testcase_06 AC 69 ms
71,440 KB
testcase_07 AC 70 ms
71,364 KB
testcase_08 AC 69 ms
71,300 KB
testcase_09 AC 70 ms
71,176 KB
testcase_10 AC 68 ms
71,444 KB
testcase_11 AC 69 ms
71,308 KB
testcase_12 AC 70 ms
71,356 KB
testcase_13 AC 70 ms
71,340 KB
testcase_14 AC 70 ms
71,512 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 70 ms
71,380 KB
testcase_19 AC 68 ms
71,424 KB
testcase_20 AC 70 ms
71,144 KB
testcase_21 AC 70 ms
71,444 KB
testcase_22 AC 70 ms
71,444 KB
testcase_23 WA -
testcase_24 AC 70 ms
71,440 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 71 ms
71,656 KB
testcase_29 AC 70 ms
71,432 KB
testcase_30 WA -
testcase_31 AC 70 ms
71,656 KB
testcase_32 AC 72 ms
71,552 KB
testcase_33 AC 74 ms
71,636 KB
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def fibo(n):
    numbers = [0 for _ in range(N)]
    
    numbers[0] = 1
    numbers[1] = 1
    for i in range(2,n):
        numbers[i] = numbers[i-1] + numbers[i-2]

    return numbers

numbers = fibo(N)
diff = numbers[N-1] - M

count = 0
for i in reversed(range(0,N-1)):
    if 0 <= diff - numbers[i]:
        diff = diff - numbers[i]
        count = count + 1
        if diff == 0:
            break
print(count)        
0