結果

問題 No.1407 Kindness
ユーザー roarisroaris
提出日時 2021-03-02 04:20:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 431 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 82,548 KB
実行使用メモリ 85,912 KB
最終ジャッジ日時 2024-04-14 04:22:37
合計ジャッジ時間 4,190 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,168 KB
testcase_01 AC 35 ms
52,952 KB
testcase_02 AC 36 ms
52,596 KB
testcase_03 AC 36 ms
53,532 KB
testcase_04 AC 36 ms
53,424 KB
testcase_05 AC 38 ms
53,324 KB
testcase_06 AC 37 ms
52,620 KB
testcase_07 AC 36 ms
52,884 KB
testcase_08 AC 37 ms
54,064 KB
testcase_09 AC 36 ms
53,668 KB
testcase_10 AC 35 ms
53,284 KB
testcase_11 AC 36 ms
53,236 KB
testcase_12 AC 96 ms
84,584 KB
testcase_13 AC 61 ms
72,688 KB
testcase_14 AC 64 ms
74,532 KB
testcase_15 AC 94 ms
84,076 KB
testcase_16 AC 79 ms
80,756 KB
testcase_17 AC 74 ms
79,288 KB
testcase_18 AC 73 ms
79,196 KB
testcase_19 AC 88 ms
82,948 KB
testcase_20 AC 84 ms
81,860 KB
testcase_21 AC 56 ms
67,888 KB
testcase_22 AC 56 ms
67,996 KB
testcase_23 AC 85 ms
81,872 KB
testcase_24 AC 100 ms
85,892 KB
testcase_25 AC 74 ms
79,324 KB
testcase_26 AC 79 ms
80,752 KB
testcase_27 AC 56 ms
68,812 KB
testcase_28 AC 101 ms
83,944 KB
testcase_29 AC 55 ms
67,260 KB
testcase_30 AC 97 ms
84,752 KB
testcase_31 AC 60 ms
72,812 KB
testcase_32 AC 89 ms
83,136 KB
testcase_33 AC 63 ms
74,328 KB
testcase_34 AC 81 ms
81,376 KB
testcase_35 AC 62 ms
73,312 KB
testcase_36 AC 54 ms
66,048 KB
testcase_37 AC 92 ms
85,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N = input()[:-1]
L = len(N)
dp = [[0]*2 for _ in range(L+1)]
dp[0][0] = 1
MOD = 10**9+7

for i in range(L):
    d = int(N[i])
    
    for j in range(2):
        for k in range(10 if j else d+1):
            dp[i+1][j|(k<d)] += dp[i][j]*k
    
    if i>0:
        for j in range(10):
            dp[i+1][1] += j
        
    for j in range(2):
        dp[i+1][j] %= MOD

print(sum(dp[L])%MOD)
0