結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー al1ce_nanka189ral1ce_nanka189r
提出日時 2017-06-11 19:16:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
MLE  
実行時間 -
コード長 319 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 11,852 KB
実行使用メモリ 815,368 KB
最終ジャッジ日時 2023-10-24 21:11:35
合計ジャッジ時間 4,291 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,212 KB
testcase_01 AC 30 ms
10,212 KB
testcase_02 AC 29 ms
10,212 KB
testcase_03 AC 30 ms
10,212 KB
testcase_04 AC 28 ms
10,212 KB
testcase_05 AC 29 ms
10,212 KB
testcase_06 AC 28 ms
10,212 KB
testcase_07 AC 28 ms
10,288 KB
testcase_08 AC 35 ms
14,884 KB
testcase_09 AC 853 ms
466,996 KB
testcase_10 MLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-

import math

#-------
# Initialize
N,M = map(int, input().split())
array = [0] * N

#-------
# Define
def fib(n):
    array[0] = 0
    array[1] = 1
    for i in range(2, n, 1):
        array[i] = array[i-1] + array[i-2]
    return array[n-1]

#-------
# Do
print(fib(N) % M)

#-------
# Output
0