結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー ueyukiueyuki
提出日時 2017-06-21 06:07:27
言語 Ruby
(3.3.0)
結果
MLE  
実行時間 -
コード長 126 bytes
コンパイル時間 192 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 817,664 KB
最終ジャッジ日時 2024-04-10 06:52:17
合計ジャッジ時間 3,490 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
12,160 KB
testcase_01 AC 81 ms
12,288 KB
testcase_02 AC 79 ms
12,288 KB
testcase_03 AC 78 ms
12,160 KB
testcase_04 AC 80 ms
12,288 KB
testcase_05 AC 78 ms
12,032 KB
testcase_06 AC 78 ms
12,160 KB
testcase_07 AC 77 ms
12,160 KB
testcase_08 AC 87 ms
16,512 KB
testcase_09 AC 533 ms
442,624 KB
testcase_10 MLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n, m = gets.split.map(&:to_i)
i = 3
num = [0, 0, 1]

while i <= n
  num << num[i-1] + num[i-2]
  i += 1
end

puts num[i-1] % m
0