結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー _KingdomOfMoray_KingdomOfMoray
提出日時 2020-01-06 19:38:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 196 bytes
コンパイル時間 114 ms
コンパイル使用メモリ 10,660 KB
実行使用メモリ 8,108 KB
最終ジャッジ日時 2023-08-14 22:49:48
合計ジャッジ時間 1,157 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,920 KB
testcase_01 AC 16 ms
7,944 KB
testcase_02 AC 15 ms
8,068 KB
testcase_03 AC 15 ms
7,956 KB
testcase_04 AC 15 ms
7,920 KB
testcase_05 AC 14 ms
7,908 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

input_list = list(map(int,input().split()))
n, m = input_list

n -= 1
fn = (((1 + math.sqrt(5)) / 2) ** n - ((1 - math.sqrt(5)) / 2) ** n) / math.sqrt(5)
res = int(fn) % m

print(res)
0