結果

問題 No.741 AscNumber(Easy)
ユーザー neko_the_shadowneko_the_shadow
提出日時 2018-10-05 21:52:31
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 254 bytes
コンパイル時間 64 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 18,048 KB
最終ジャッジ日時 2024-04-20 17:11:10
合計ジャッジ時間 7,178 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
12,288 KB
testcase_01 AC 77 ms
12,288 KB
testcase_02 AC 80 ms
12,160 KB
testcase_03 AC 77 ms
12,288 KB
testcase_04 AC 78 ms
12,288 KB
testcase_05 AC 75 ms
12,288 KB
testcase_06 AC 75 ms
12,288 KB
testcase_07 AC 78 ms
12,160 KB
testcase_08 AC 76 ms
12,160 KB
testcase_09 AC 76 ms
12,288 KB
testcase_10 AC 76 ms
12,288 KB
testcase_11 AC 78 ms
12,160 KB
testcase_12 AC 79 ms
12,288 KB
testcase_13 AC 79 ms
12,288 KB
testcase_14 AC 78 ms
12,288 KB
testcase_15 AC 78 ms
12,032 KB
testcase_16 AC 78 ms
12,160 KB
testcase_17 AC 77 ms
12,160 KB
testcase_18 AC 79 ms
12,288 KB
testcase_19 AC 77 ms
12,160 KB
testcase_20 AC 113 ms
12,928 KB
testcase_21 AC 92 ms
12,544 KB
testcase_22 AC 151 ms
13,824 KB
testcase_23 AC 136 ms
13,568 KB
testcase_24 AC 92 ms
12,416 KB
testcase_25 AC 103 ms
12,672 KB
testcase_26 AC 126 ms
13,312 KB
testcase_27 AC 101 ms
12,672 KB
testcase_28 AC 98 ms
12,416 KB
testcase_29 AC 103 ms
12,672 KB
testcase_30 AC 158 ms
13,184 KB
testcase_31 AC 147 ms
12,928 KB
testcase_32 AC 112 ms
12,288 KB
testcase_33 AC 150 ms
13,184 KB
testcase_34 AC 158 ms
14,208 KB
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 RE -
testcase_51 RE -
testcase_52 RE -
testcase_53 RE -
testcase_54 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

@memo = {}

def solve(last, cnt)
  return 1 if cnt == 0

  key = [last, cnt]
  return @memo[key] if @memo.key?(key)

  ans = 0
  (last..9).each{|digit| ans += solve(digit, cnt - 1)}
  @memo[key] = ans % (10 ** 9 + 7)
end

n = gets.to_i
puts solve(0, n)

0