結果

問題 No.1407 Kindness
ユーザー maguroflymagurofly
提出日時 2021-02-26 23:01:09
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 239 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 21,504 KB
最終ジャッジ日時 2024-04-10 13:43:37
合計ジャッジ時間 5,218 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
12,160 KB
testcase_01 AC 78 ms
12,160 KB
testcase_02 AC 78 ms
12,160 KB
testcase_03 AC 74 ms
12,288 KB
testcase_04 AC 76 ms
12,416 KB
testcase_05 AC 77 ms
12,288 KB
testcase_06 AC 77 ms
12,288 KB
testcase_07 AC 77 ms
12,160 KB
testcase_08 AC 76 ms
12,288 KB
testcase_09 AC 74 ms
12,160 KB
testcase_10 AC 73 ms
12,288 KB
testcase_11 AC 72 ms
12,160 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 81 ms
13,184 KB
testcase_22 AC 92 ms
13,568 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 86 ms
13,184 KB
testcase_28 RE -
testcase_29 AC 80 ms
12,544 KB
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 AC 78 ms
12,672 KB
testcase_37 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

MOD = 10**9+7
N = gets.chomp.chars.map(&:to_i)
L = N.size
def rec(n)
    return 1 if n == 0
    ((1 .. N[L - n] - 1).sum * 45.pow(n-1, MOD) % MOD + N[L - n] * rec(n - 1)) % MOD
end
puts ((1 ... L).sum { |n| 45.pow(n, MOD) } + rec(L)) % MOD
0