結果

問題 No.1417 100の倍数かつ正整数(2)
ユーザー trineutrontrineutron
提出日時 2021-03-05 22:45:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 654 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 31,232 KB
最終ジャッジ日時 2024-04-16 10:33:09
合計ジャッジ時間 13,361 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
16,128 KB
testcase_01 AC 34 ms
10,624 KB
testcase_02 AC 92 ms
11,008 KB
testcase_03 AC 29 ms
10,624 KB
testcase_04 AC 31 ms
10,496 KB
testcase_05 AC 31 ms
10,624 KB
testcase_06 AC 32 ms
10,496 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 34 ms
10,752 KB
testcase_12 AC 42 ms
10,496 KB
testcase_13 WA -
testcase_14 AC 49 ms
10,752 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 89 ms
10,880 KB
testcase_22 AC 93 ms
11,008 KB
testcase_23 WA -
testcase_24 AC 95 ms
11,008 KB
testcase_25 WA -
testcase_26 AC 98 ms
11,008 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 675 ms
14,848 KB
testcase_32 WA -
testcase_33 TLE -
testcase_34 TLE -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

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
            if k == d:
                dp0[i + 1][newj] += dp0[i][j]
            if k < d:
                dp1[i + 1][newj] += dp0[i][j]
            if i:
                dp1[i + 1][k] += 1
            elif k == d:
                dp0[i + 1][k] += 1
            dp1[i + 1][newj] += dp1[i][j]
print((dp0[l][0] + dp1[l][0]) * pow(100, -1, mod) % mod)
0