結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー gemmarogemmaro
提出日時 2019-11-15 08:50:42
言語 Ruby
(3.3.0)
結果
MLE  
実行時間 -
コード長 159 bytes
コンパイル時間 478 ms
コンパイル使用メモリ 11,828 KB
実行使用メモリ 812,932 KB
最終ジャッジ日時 2023-10-24 03:39:55
合計ジャッジ時間 4,275 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
16,052 KB
testcase_01 AC 82 ms
16,052 KB
testcase_02 AC 83 ms
16,052 KB
testcase_03 AC 84 ms
16,052 KB
testcase_04 AC 84 ms
16,052 KB
testcase_05 AC 83 ms
16,052 KB
testcase_06 AC 85 ms
16,052 KB
testcase_07 AC 82 ms
16,052 KB
testcase_08 AC 92 ms
20,236 KB
testcase_09 AC 615 ms
446,312 KB
testcase_10 MLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# frozen_string_literal: true

n, m = gets.chomp.split.map(&:to_i)

fibs = [0, 1]
(2..n).each do |i|
  fibs << fibs[i - 1] + fibs[i - 2]
end

p fibs[n - 1] % m
0