結果
問題 | No.526 フィボナッチ数列の第N項をMで割った余りを求める |
ユーザー | gemmaro |
提出日時 | 2019-11-15 09:00:52 |
言語 | Ruby (3.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 312 bytes |
コンパイル時間 | 398 ms |
コンパイル使用メモリ | 11,852 KB |
実行使用メモリ | 150,052 KB |
最終ジャッジ日時 | 2023-10-24 03:54:11 |
合計ジャッジ時間 | 5,911 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 84 ms
16,088 KB |
testcase_01 | AC | 83 ms
16,088 KB |
testcase_02 | AC | 84 ms
16,088 KB |
testcase_03 | AC | 84 ms
16,088 KB |
testcase_04 | AC | 83 ms
16,088 KB |
testcase_05 | AC | 85 ms
16,088 KB |
testcase_06 | AC | 84 ms
16,088 KB |
testcase_07 | AC | 86 ms
16,088 KB |
testcase_08 | AC | 94 ms
20,048 KB |
testcase_09 | AC | 309 ms
95,424 KB |
testcase_10 | TLE | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
コンパイルメッセージ
Syntax OK
ソースコード
# frozen_string_literal: true n, m = gets.chomp.split.map(&:to_i) def fib(num) i = 0 b = 1 c = 0 while i < num a = b b = c c = a + b i += 1 end c end # ref: https://ja.wikipedia.org/% # wiki/%E3%83%95%E3%82%A3%E3%83%9C%E3%83%8A%E3%83%83%E3%83%81%E6%95%B0 p fib(n - 1) % m