結果

問題 No.526 フィボナッチ数列の第N項をMで割った余りを求める
ユーザー ueyukiueyuki
提出日時 2017-06-21 05:35:40
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 176 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 19,484 KB
最終ジャッジ日時 2024-04-10 06:46:47
合計ジャッジ時間 4,467 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

def fibonati(n)
  if n == 1
    return 0
  end

  if n == 2
    return 1
  end

  return fibonati(n-1) + fibonati(n-2)
end

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

puts fibonati(n) % m
0