結果

問題 No.44 DPなすごろく
ユーザー Kaoru TsutsumishitaKaoru Tsutsumishita
提出日時 2014-10-19 14:45:03
言語 Ruby
(3.3.0)
結果
AC  
実行時間 83 ms / 5,000 ms
コード長 168 bytes
コンパイル時間 522 ms
コンパイル使用メモリ 11,468 KB
実行使用メモリ 15,408 KB
最終ジャッジ日時 2023-08-28 21:27:07
合計ジャッジ時間 4,151 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,408 KB
testcase_01 AC 82 ms
15,124 KB
testcase_02 AC 81 ms
15,044 KB
testcase_03 AC 82 ms
15,036 KB
testcase_04 AC 80 ms
15,164 KB
testcase_05 AC 81 ms
15,168 KB
testcase_06 AC 83 ms
15,236 KB
testcase_07 AC 81 ms
15,096 KB
testcase_08 AC 82 ms
15,088 KB
testcase_09 AC 81 ms
15,176 KB
testcase_10 AC 82 ms
15,144 KB
testcase_11 AC 80 ms
15,172 KB
testcase_12 AC 81 ms
15,136 KB
testcase_13 AC 80 ms
15,104 KB
testcase_14 AC 81 ms
15,168 KB
testcase_15 AC 81 ms
15,020 KB
testcase_16 AC 82 ms
15,148 KB
testcase_17 AC 81 ms
15,160 KB
testcase_18 AC 81 ms
15,108 KB
testcase_19 AC 81 ms
15,044 KB
testcase_20 AC 81 ms
15,328 KB
testcase_21 AC 83 ms
15,344 KB
testcase_22 AC 83 ms
15,260 KB
testcase_23 AC 83 ms
15,048 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def main()
  input = gets.to_i
  arr = [1,1]
  now = 2

  for num in now..input
    arr[num] = arr[num-1] + arr[num-2]
  end

  p arr[input]

end

main()
0