結果

問題 No.1417 100の倍数かつ正整数(2)
ユーザー trineutrontrineutron
提出日時 2021-03-05 22:49:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 677 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 82,452 KB
実行使用メモリ 94,068 KB
最終ジャッジ日時 2024-04-16 10:36:01
合計ジャッジ時間 4,104 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
59,776 KB
testcase_01 AC 46 ms
61,824 KB
testcase_02 AC 46 ms
61,568 KB
testcase_03 AC 37 ms
52,096 KB
testcase_04 AC 41 ms
58,880 KB
testcase_05 AC 44 ms
59,648 KB
testcase_06 AC 43 ms
59,648 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 43 ms
59,648 KB
testcase_12 AC 49 ms
62,592 KB
testcase_13 WA -
testcase_14 AC 46 ms
60,672 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 52 ms
63,872 KB
testcase_22 AC 53 ms
64,512 KB
testcase_23 WA -
testcase_24 AC 48 ms
62,080 KB
testcase_25 WA -
testcase_26 AC 50 ms
64,256 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 60 ms
68,992 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 179 ms
93,568 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:
                dp1[i + 1][k] += 1
            elif k == d:
                dp0[i + 1][k] += 1
print((dp0[l][0] + dp1[l][0]) % mod)
0