結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー kokoa1046kokoa1046
提出日時 2018-02-04 19:35:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,222 ms / 2,000 ms
コード長 162 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,696 KB
実行使用メモリ 203,920 KB
最終ジャッジ日時 2023-09-12 16:05:46
合計ジャッジ時間 5,389 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,848 KB
testcase_01 AC 15 ms
7,812 KB
testcase_02 AC 15 ms
7,752 KB
testcase_03 AC 15 ms
7,840 KB
testcase_04 AC 16 ms
7,848 KB
testcase_05 AC 16 ms
7,824 KB
testcase_06 AC 16 ms
7,812 KB
testcase_07 AC 15 ms
7,820 KB
testcase_08 AC 18 ms
8,248 KB
testcase_09 AC 35 ms
11,968 KB
testcase_10 AC 191 ms
47,252 KB
testcase_11 AC 1,135 ms
203,852 KB
testcase_12 AC 602 ms
47,112 KB
testcase_13 AC 1,222 ms
203,844 KB
testcase_14 AC 1,086 ms
203,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
def test(n,m):
    dp=[0]*n
    dp[1]=1
    for i in range(2,n):
        dp[i]=(dp[i-2]+dp[i-1])%m
    return dp[-1]
print(test(n,m))
0