結果

問題 No.1417 100の倍数かつ正整数(2)
ユーザー 👑 H20H20
提出日時 2021-02-23 20:53:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,221 ms / 3,000 ms
コード長 807 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 81,840 KB
実行使用メモリ 253,052 KB
最終ジャッジ日時 2023-10-25 05:31:07
合計ジャッジ時間 14,376 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
64,416 KB
testcase_01 AC 67 ms
68,644 KB
testcase_02 AC 80 ms
77,432 KB
testcase_03 AC 48 ms
60,180 KB
testcase_04 AC 59 ms
64,476 KB
testcase_05 AC 61 ms
66,544 KB
testcase_06 AC 64 ms
66,544 KB
testcase_07 AC 65 ms
68,652 KB
testcase_08 AC 65 ms
68,648 KB
testcase_09 AC 69 ms
68,648 KB
testcase_10 AC 69 ms
68,652 KB
testcase_11 AC 58 ms
64,464 KB
testcase_12 AC 70 ms
70,712 KB
testcase_13 AC 67 ms
70,692 KB
testcase_14 AC 61 ms
68,560 KB
testcase_15 AC 74 ms
74,844 KB
testcase_16 AC 75 ms
74,776 KB
testcase_17 AC 72 ms
73,904 KB
testcase_18 AC 81 ms
76,912 KB
testcase_19 AC 85 ms
77,096 KB
testcase_20 AC 85 ms
77,096 KB
testcase_21 AC 86 ms
77,352 KB
testcase_22 AC 86 ms
77,416 KB
testcase_23 AC 93 ms
77,624 KB
testcase_24 AC 80 ms
77,428 KB
testcase_25 AC 93 ms
77,624 KB
testcase_26 AC 92 ms
77,516 KB
testcase_27 AC 93 ms
77,528 KB
testcase_28 AC 95 ms
77,624 KB
testcase_29 AC 96 ms
77,624 KB
testcase_30 AC 228 ms
89,672 KB
testcase_31 AC 198 ms
93,464 KB
testcase_32 AC 442 ms
111,488 KB
testcase_33 AC 823 ms
164,564 KB
testcase_34 AC 1,705 ms
248,888 KB
testcase_35 AC 1,800 ms
252,756 KB
testcase_36 AC 1,830 ms
253,052 KB
testcase_37 AC 2,221 ms
252,852 KB
testcase_38 AC 1,355 ms
252,644 KB
権限があれば一括ダウンロードができます

ソースコード

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][1] = 1

    for i, less, mod100, leading0 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):
            if leading0==0 and d==0:
                continue
            less_ = less or d < max_d
            leading0_ = leading0 and d == 0
            if leading0==1 and d==0:
                mod100_ = mod100
            else:
                mod100_ = (mod100*d)%100

            dp[i + 1][less_][mod100_][leading0_] = (dp[i][less][mod100][leading0]+dp[i + 1][less_][mod100_][leading0_])%mod

    return (dp[n][1][0][0]+dp[n][0][0][0])%mod

print(count(N))
0