結果
| 問題 | No.526 フィボナッチ数列の第N項をMで割った余りを求める |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-06-22 14:35:49 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 237 bytes |
| コンパイル時間 | 163 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-10-02 12:13:24 |
| 合計ジャッジ時間 | 7,497 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 3 WA * 2 RE * 7 |
ソースコード
import math
N,M=(int(i) for i in input().split())
fp=math.sqrt(5)
fp+=1
fp/=2
fm=math.sqrt(5)*(-1)
fm+=1
fm/=2
fip=1.0
fim=1.0
for i in range(N-1):
fip*=fp
fim*=fm
# print(fp)
fip-=fim
fip/=math.sqrt(5)
FN=int(fip)%M
print(FN)