結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー nonokai10nonokai10
提出日時 2018-03-12 13:16:02
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 106 bytes
コンパイル時間 65 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 94,272 KB
最終ジャッジ日時 2024-04-25 05:58:35
合計ジャッジ時間 4,740 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
17,664 KB
testcase_01 AC 82 ms
12,160 KB
testcase_02 AC 82 ms
12,288 KB
testcase_03 AC 78 ms
12,160 KB
testcase_04 AC 77 ms
12,288 KB
testcase_05 AC 79 ms
12,288 KB
testcase_06 AC 76 ms
12,160 KB
testcase_07 AC 82 ms
12,416 KB
testcase_08 AC 87 ms
15,488 KB
testcase_09 AC 277 ms
75,648 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n, m = gets.split.map(&:to_i)
a = 0
b = 1
c = 0
(3..n).each do |i|
  c = a + b
  a = b
  b = c
end
p c % m
0