結果

問題 No.1417 100の倍数かつ正整数(2)
ユーザー 👑 H20H20
提出日時 2021-02-20 02:28:09
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 643 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 81,436 KB
実行使用メモリ 156,296 KB
最終ジャッジ日時 2023-10-25 04:56:44
合計ジャッジ時間 21,837 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
73,156 KB
testcase_01 AC 97 ms
75,916 KB
testcase_02 AC 1,306 ms
156,296 KB
testcase_03 AC 46 ms
61,840 KB
testcase_04 AC 63 ms
68,792 KB
testcase_05 AC 71 ms
72,936 KB
testcase_06 AC 71 ms
72,936 KB
testcase_07 AC 76 ms
72,984 KB
testcase_08 AC 74 ms
73,076 KB
testcase_09 AC 74 ms
73,080 KB
testcase_10 AC 80 ms
74,568 KB
testcase_11 AC 92 ms
75,916 KB
testcase_12 AC 129 ms
76,192 KB
testcase_13 AC 140 ms
76,580 KB
testcase_14 AC 229 ms
78,764 KB
testcase_15 AC 302 ms
81,732 KB
testcase_16 AC 341 ms
83,848 KB
testcase_17 AC 374 ms
84,944 KB
testcase_18 AC 567 ms
95,608 KB
testcase_19 AC 638 ms
100,676 KB
testcase_20 AC 671 ms
102,268 KB
testcase_21 AC 1,048 ms
132,312 KB
testcase_22 AC 1,156 ms
140,928 KB
testcase_23 AC 1,208 ms
146,000 KB
testcase_24 AC 1,234 ms
149,320 KB
testcase_25 AC 1,239 ms
148,648 KB
testcase_26 AC 1,271 ms
151,140 KB
testcase_27 AC 1,290 ms
153,780 KB
testcase_28 AC 1,290 ms
153,764 KB
testcase_29 AC 1,298 ms
152,668 KB
testcase_30 TLE -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product

N = input()
mod=10**9+7

def count(a):
    n = len(a)
    dp=[[[[0] * 2 for i in range(100)] for j in range(2)] for k in range(n+1)]
    dp[0][0][1][0] = 1

    for i, less, mod100, has0 in product(range(n), (0,1), range(100), (0,1)):
        max_d = 9 if less else int(a[i])
        for d in range(max_d+1):
            less_ = less or d < max_d
            mod100_ = (mod100*d)%100
            has0_ = has0 or d==0
            dp[i + 1][less_][mod100_][has0_] += dp[i][less][mod100][has0]

    return dp[n][1][0][0]+dp[n][0][0][0]

ans = count(N)
for i in range(len(N)):
    ans += count('9'*i)
print(ans%mod)
0