結果

問題 No.1407 Kindness
ユーザー 👑 terry_u16terry_u16
提出日時 2021-02-26 21:50:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 632 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 82,368 KB
実行使用メモリ 85,020 KB
最終ジャッジ日時 2024-04-10 12:30:15
合計ジャッジ時間 4,046 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,552 KB
testcase_01 AC 38 ms
52,604 KB
testcase_02 AC 37 ms
53,052 KB
testcase_03 AC 37 ms
52,532 KB
testcase_04 AC 40 ms
52,688 KB
testcase_05 AC 37 ms
53,052 KB
testcase_06 AC 37 ms
52,872 KB
testcase_07 AC 37 ms
52,464 KB
testcase_08 AC 37 ms
52,888 KB
testcase_09 AC 37 ms
52,568 KB
testcase_10 AC 37 ms
52,816 KB
testcase_11 AC 37 ms
53,296 KB
testcase_12 AC 101 ms
84,808 KB
testcase_13 AC 72 ms
78,364 KB
testcase_14 AC 75 ms
78,536 KB
testcase_15 AC 103 ms
83,696 KB
testcase_16 AC 86 ms
80,868 KB
testcase_17 AC 75 ms
78,808 KB
testcase_18 AC 79 ms
78,272 KB
testcase_19 AC 95 ms
83,048 KB
testcase_20 AC 90 ms
81,332 KB
testcase_21 AC 60 ms
71,828 KB
testcase_22 AC 64 ms
73,804 KB
testcase_23 AC 90 ms
81,440 KB
testcase_24 AC 112 ms
85,020 KB
testcase_25 AC 77 ms
78,164 KB
testcase_26 AC 88 ms
80,276 KB
testcase_27 AC 61 ms
71,676 KB
testcase_28 AC 106 ms
83,584 KB
testcase_29 AC 58 ms
68,632 KB
testcase_30 AC 109 ms
84,092 KB
testcase_31 AC 73 ms
78,396 KB
testcase_32 AC 99 ms
82,904 KB
testcase_33 AC 74 ms
78,248 KB
testcase_34 AC 90 ms
81,756 KB
testcase_35 AC 72 ms
78,440 KB
testcase_36 AC 56 ms
67,464 KB
testcase_37 AC 98 ms
84,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()
n = len(s)
mod = 1000000007

dp = [[0 for _ in range(2)] for _ in range(n + 1)]
eq = 0
less = 1

for i in range(n):
    c = int(s[i])
    for d in range(c):
        dp[i + 1][less] += dp[i][eq] * d
        dp[i + 1][less] %= mod

    dp[i + 1][eq] += dp[i][eq] * c
    

    for d in range(10):
        dp[i + 1][less] += dp[i][less] * d

    if i == 0:
        dp[i + 1][eq] += c
        for d in range(c):
            dp[i + 1][less] += d
    else:
        for d in range(10):
            dp[i + 1][less] += d

    dp[i + 1][eq] %= mod
    dp[i + 1][less] %= mod
    

sm = dp[n][eq] + dp[n][less]
sm %= mod

print(sm)
0