結果

問題 No.1417 100の倍数かつ正整数(2)
ユーザー trineutrontrineutron
提出日時 2021-03-05 22:53:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 242 ms / 3,000 ms
コード長 686 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 93,696 KB
最終ジャッジ日時 2024-04-16 10:47:17
合計ジャッジ時間 4,404 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
59,648 KB
testcase_01 AC 46 ms
61,824 KB
testcase_02 AC 45 ms
61,568 KB
testcase_03 AC 34 ms
52,096 KB
testcase_04 AC 40 ms
59,264 KB
testcase_05 AC 46 ms
59,648 KB
testcase_06 AC 42 ms
59,392 KB
testcase_07 AC 41 ms
59,008 KB
testcase_08 AC 45 ms
60,928 KB
testcase_09 AC 44 ms
61,056 KB
testcase_10 AC 44 ms
60,800 KB
testcase_11 AC 42 ms
59,520 KB
testcase_12 AC 47 ms
62,336 KB
testcase_13 AC 47 ms
62,336 KB
testcase_14 AC 44 ms
60,672 KB
testcase_15 AC 52 ms
65,408 KB
testcase_16 AC 49 ms
63,488 KB
testcase_17 AC 48 ms
62,592 KB
testcase_18 AC 50 ms
63,360 KB
testcase_19 AC 51 ms
64,128 KB
testcase_20 AC 49 ms
62,848 KB
testcase_21 AC 52 ms
64,128 KB
testcase_22 AC 54 ms
64,640 KB
testcase_23 AC 56 ms
64,768 KB
testcase_24 AC 50 ms
62,388 KB
testcase_25 AC 52 ms
64,128 KB
testcase_26 AC 53 ms
64,128 KB
testcase_27 AC 52 ms
64,128 KB
testcase_28 AC 52 ms
64,000 KB
testcase_29 AC 50 ms
63,488 KB
testcase_30 AC 68 ms
71,296 KB
testcase_31 AC 60 ms
68,992 KB
testcase_32 AC 96 ms
80,000 KB
testcase_33 AC 137 ms
84,844 KB
testcase_34 AC 222 ms
93,056 KB
testcase_35 AC 242 ms
93,568 KB
testcase_36 AC 242 ms
93,696 KB
testcase_37 AC 231 ms
93,440 KB
testcase_38 AC 184 ms
93,440 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