結果

問題 No.741 AscNumber(Easy)
ユーザー hoktohokto
提出日時 2020-03-26 09:55:53
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 1,344 bytes
コンパイル時間 69 ms
コンパイル使用メモリ 11,568 KB
実行使用メモリ 405,872 KB
最終ジャッジ日時 2023-08-30 12:10:25
合計ジャッジ時間 9,163 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
19,608 KB
testcase_01 AC 83 ms
14,992 KB
testcase_02 AC 83 ms
15,164 KB
testcase_03 AC 83 ms
15,228 KB
testcase_04 AC 84 ms
15,356 KB
testcase_05 AC 83 ms
15,144 KB
testcase_06 AC 83 ms
15,144 KB
testcase_07 AC 83 ms
15,108 KB
testcase_08 AC 84 ms
15,096 KB
testcase_09 AC 83 ms
15,188 KB
testcase_10 AC 83 ms
15,084 KB
testcase_11 AC 83 ms
15,180 KB
testcase_12 AC 85 ms
15,228 KB
testcase_13 AC 84 ms
15,136 KB
testcase_14 AC 82 ms
14,992 KB
testcase_15 AC 84 ms
15,320 KB
testcase_16 AC 84 ms
15,100 KB
testcase_17 AC 84 ms
15,232 KB
testcase_18 AC 83 ms
15,120 KB
testcase_19 AC 85 ms
15,204 KB
testcase_20 AC 98 ms
15,596 KB
testcase_21 AC 91 ms
15,448 KB
testcase_22 AC 107 ms
15,796 KB
testcase_23 AC 103 ms
15,520 KB
testcase_24 AC 89 ms
15,264 KB
testcase_25 AC 93 ms
15,328 KB
testcase_26 AC 100 ms
15,620 KB
testcase_27 AC 89 ms
15,356 KB
testcase_28 AC 89 ms
15,440 KB
testcase_29 AC 91 ms
15,208 KB
testcase_30 AC 100 ms
15,620 KB
testcase_31 AC 98 ms
15,564 KB
testcase_32 AC 86 ms
15,224 KB
testcase_33 AC 100 ms
15,732 KB
testcase_34 AC 111 ms
15,764 KB
testcase_35 TLE -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

L=gets.to_i
D=[0]*L
D.unshift(1)
dp=Array.new(L+1){Array.new(2){Array.new(10){0}}}

10.times do|i|
    dp[1][1][i]=1
end
L.times do|i|
  2.times do|j|
        lim=(j==1 ? 10 : D[i]+1)
        lim.times do|d|
            d.upto(lim-1).each do|k|
              dp[i+1][j==1||d<D[i] ? 1 : 0][k]+=dp[i][j][d]
              dp[i+1][j==1||d<D[i] ? 1 : 0][k]%=(10**9+7)
            end
        end
  end
end

puts dp[L][1].inject(:+)% (10**9+7)
0