結果

問題 No.1417 100の倍数かつ正整数(2)
ユーザー trineutrontrineutron
提出日時 2021-03-05 22:53:55
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 283 ms / 3,000 ms
コード長 686 bytes
コンパイル時間 1,210 ms
コンパイル使用メモリ 87,000 KB
実行使用メモリ 94,724 KB
最終ジャッジ日時 2023-07-29 03:20:44
合計ジャッジ時間 6,536 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
76,620 KB
testcase_01 AC 82 ms
76,532 KB
testcase_02 AC 80 ms
76,592 KB
testcase_03 AC 75 ms
71,216 KB
testcase_04 AC 77 ms
75,968 KB
testcase_05 AC 79 ms
76,028 KB
testcase_06 AC 80 ms
76,188 KB
testcase_07 AC 77 ms
76,044 KB
testcase_08 AC 80 ms
76,396 KB
testcase_09 AC 83 ms
76,364 KB
testcase_10 AC 82 ms
76,632 KB
testcase_11 AC 79 ms
76,508 KB
testcase_12 AC 84 ms
76,548 KB
testcase_13 AC 82 ms
76,480 KB
testcase_14 AC 81 ms
76,604 KB
testcase_15 AC 92 ms
76,696 KB
testcase_16 AC 85 ms
76,500 KB
testcase_17 AC 84 ms
76,568 KB
testcase_18 AC 86 ms
76,472 KB
testcase_19 AC 87 ms
76,600 KB
testcase_20 AC 84 ms
76,552 KB
testcase_21 AC 86 ms
76,612 KB
testcase_22 AC 87 ms
76,640 KB
testcase_23 AC 90 ms
76,496 KB
testcase_24 AC 83 ms
76,660 KB
testcase_25 AC 85 ms
76,468 KB
testcase_26 AC 85 ms
76,620 KB
testcase_27 AC 86 ms
76,604 KB
testcase_28 AC 87 ms
76,616 KB
testcase_29 AC 86 ms
76,632 KB
testcase_30 AC 102 ms
76,732 KB
testcase_31 AC 93 ms
76,464 KB
testcase_32 AC 128 ms
80,940 KB
testcase_33 AC 165 ms
85,924 KB
testcase_34 AC 257 ms
94,528 KB
testcase_35 AC 279 ms
94,652 KB
testcase_36 AC 283 ms
94,724 KB
testcase_37 AC 263 ms
94,720 KB
testcase_38 AC 218 ms
94,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10**9 + 7

n = input()
l = len(n)
dp0 = [[0] * 100 for i in range(l + 1)]
dp1 = [[0] * 100 for i in range(l + 1)]
for i in range(l):
    d = ord(n[i]) - ord('0')
    for j in range(100):
        dp0[i][j] %= mod
        dp1[i][j] %= mod
        for k in range(1, 10):
            newj = j * k % 100
            dp1[i + 1][newj] += dp1[i][j]
            if k == d:
                dp0[i + 1][newj] += dp0[i][j]
            if k < d:
                dp1[i + 1][newj] += dp0[i][j]
            if j:
                continue
            if i or k < d:
                dp1[i + 1][k] += 1
            elif k == d:
                dp0[i + 1][k] += 1
print((dp0[l][0] + dp1[l][0]) % mod)
0