結果
| 問題 |
No.526 フィボナッチ数列の第N項をMで割った余りを求める
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-12-04 22:15:59 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 75 ms / 2,000 ms |
| コード長 | 255 bytes |
| コンパイル時間 | 155 ms |
| コンパイル使用メモリ | 82,020 KB |
| 実行使用メモリ | 59,388 KB |
| 最終ジャッジ日時 | 2024-09-15 08:57:46 |
| 合計ジャッジ時間 | 1,584 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
ソースコード
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
N, M = mapint()
old = 0
new = 1
for i in range(2, N):
new, old = old+new, new
new %= M
old %= M
print(new)