結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー JunOnumaJunOnuma
提出日時 2017-06-12 14:33:48
言語 Python2
(2.7.18)
結果
AC  
実行時間 1,954 ms / 2,000 ms
コード長 138 bytes
コンパイル時間 352 ms
コンパイル使用メモリ 7,152 KB
実行使用メモリ 324,380 KB
最終ジャッジ日時 2023-10-24 21:31:46
合計ジャッジ時間 9,084 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,424 KB
testcase_01 AC 10 ms
6,424 KB
testcase_02 AC 10 ms
6,424 KB
testcase_03 AC 10 ms
6,424 KB
testcase_04 AC 10 ms
6,424 KB
testcase_05 AC 9 ms
6,424 KB
testcase_06 AC 10 ms
6,424 KB
testcase_07 AC 10 ms
6,444 KB
testcase_08 AC 13 ms
6,828 KB
testcase_09 AC 47 ms
12,596 KB
testcase_10 AC 389 ms
69,800 KB
testcase_11 AC 1,954 ms
324,012 KB
testcase_12 AC 1,748 ms
204,524 KB
testcase_13 AC 1,904 ms
324,380 KB
testcase_14 AC 1,902 ms
324,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int, raw_input().split())
l = [0 for _ in range(n)]
l[1] = 1
for i in range(2,n):
    l[i] = (l[i-1] + l[i-2]) % m
print l[n-1]
0