結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
12,160 KB
testcase_01 AC 79 ms
12,288 KB
testcase_02 AC 77 ms
12,288 KB
testcase_03 AC 78 ms
12,288 KB
testcase_04 AC 78 ms
12,160 KB
testcase_05 AC 80 ms
12,160 KB
testcase_06 AC 79 ms
12,160 KB
testcase_07 AC 79 ms
12,288 KB
testcase_08 AC 77 ms
12,288 KB
testcase_09 AC 77 ms
12,032 KB
testcase_10 AC 80 ms
12,416 KB
testcase_11 AC 79 ms
12,288 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 86 ms
13,056 KB
testcase_22 AC 91 ms
13,312 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 100 ms
13,312 KB
testcase_28 RE -
testcase_29 AC 84 ms
12,672 KB
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 AC 88 ms
12,288 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) } % MOD + rec(L)) % MOD
0