結果

問題 No.1085 桁和の桁和
ユーザー H3PO4H3PO4
提出日時 2021-10-09 09:43:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 503 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 10,676 KB
実行使用メモリ 30,036 KB
最終ジャッジ日時 2023-10-01 04:37:00
合計ジャッジ時間 25,075 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
29,576 KB
testcase_01 AC 138 ms
29,480 KB
testcase_02 AC 134 ms
29,720 KB
testcase_03 AC 134 ms
29,640 KB
testcase_04 AC 799 ms
29,944 KB
testcase_05 AC 131 ms
29,676 KB
testcase_06 AC 132 ms
29,588 KB
testcase_07 AC 135 ms
29,636 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 134 ms
29,572 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 251 ms
29,656 KB
testcase_14 AC 512 ms
29,620 KB
testcase_15 AC 978 ms
29,828 KB
testcase_16 AC 973 ms
29,816 KB
testcase_17 AC 525 ms
29,684 KB
testcase_18 AC 341 ms
29,696 KB
testcase_19 AC 892 ms
29,796 KB
testcase_20 AC 885 ms
29,932 KB
testcase_21 AC 634 ms
29,664 KB
testcase_22 AC 849 ms
29,728 KB
testcase_23 AC 198 ms
29,612 KB
testcase_24 AC 142 ms
29,740 KB
testcase_25 AC 576 ms
29,732 KB
testcase_26 AC 986 ms
29,840 KB
testcase_27 AC 838 ms
29,832 KB
testcase_28 AC 1,169 ms
29,964 KB
testcase_29 AC 653 ms
29,840 KB
testcase_30 AC 618 ms
29,684 KB
testcase_31 AC 972 ms
29,828 KB
testcase_32 AC 709 ms
29,892 KB
testcase_33 AC 861 ms
29,852 KB
testcase_34 AC 827 ms
29,936 KB
testcase_35 AC 824 ms
29,860 KB
testcase_36 AC 825 ms
29,872 KB
testcase_37 AC 853 ms
29,900 KB
testcase_38 AC 817 ms
30,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

T = input()
D = int(input())

MOD = 10 ** 9 + 7
dp = np.zeros(9, dtype=np.int64)
dp[0] = 1
zero_flag = True
for t in T:
    if t == '?':
        dp += np.full(9, dp.sum())
        dp %= MOD
    else:
        t = int(t)
        if t:
            zero_flag = False
            dp = np.roll(dp, t)
if zero_flag:
    dp[8] -= 1
    if D:
        D %= 9
        ans = dp[D]
    else:
        ans = 1
else:
    if D:
        D %= 9
        ans = dp[D]
    else:
        ans = 0
print(ans)
0