結果
| 問題 | No.526 フィボナッチ数列の第N項をMで割った余りを求める |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-06-22 14:34:53 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 236 bytes |
| コンパイル時間 | 484 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 17,572 KB |
| 最終ジャッジ日時 | 2024-10-02 12:13:14 |
| 合計ジャッジ時間 | 6,550 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 5 RE * 3 OLE * 1 -- * 3 |
ソースコード
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)