結果

問題 No.1085 桁和の桁和
ユーザー rlangevinrlangevin
提出日時 2023-08-01 12:35:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 366 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 82,384 KB
実行使用メモリ 68,800 KB
最終ジャッジ日時 2024-04-19 12:09:38
合計ジャッジ時間 2,999 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
52,420 KB
testcase_01 AC 38 ms
52,200 KB
testcase_02 AC 37 ms
52,736 KB
testcase_03 AC 32 ms
53,360 KB
testcase_04 AC 38 ms
64,344 KB
testcase_05 AC 36 ms
53,112 KB
testcase_06 AC 32 ms
52,652 KB
testcase_07 AC 31 ms
52,900 KB
testcase_08 AC 33 ms
52,204 KB
testcase_09 AC 33 ms
52,708 KB
testcase_10 AC 32 ms
53,348 KB
testcase_11 AC 31 ms
53,752 KB
testcase_12 AC 33 ms
52,356 KB
testcase_13 AC 37 ms
59,600 KB
testcase_14 AC 40 ms
63,124 KB
testcase_15 AC 41 ms
66,180 KB
testcase_16 AC 42 ms
67,100 KB
testcase_17 AC 40 ms
63,696 KB
testcase_18 AC 41 ms
60,980 KB
testcase_19 AC 43 ms
65,912 KB
testcase_20 AC 43 ms
66,760 KB
testcase_21 AC 41 ms
64,596 KB
testcase_22 AC 40 ms
65,404 KB
testcase_23 AC 38 ms
59,916 KB
testcase_24 AC 32 ms
52,748 KB
testcase_25 AC 39 ms
63,096 KB
testcase_26 AC 40 ms
67,480 KB
testcase_27 AC 41 ms
66,880 KB
testcase_28 AC 44 ms
68,800 KB
testcase_29 AC 41 ms
64,676 KB
testcase_30 AC 40 ms
63,096 KB
testcase_31 AC 41 ms
66,348 KB
testcase_32 AC 38 ms
64,860 KB
testcase_33 AC 39 ms
67,892 KB
testcase_34 AC 39 ms
67,276 KB
testcase_35 AC 40 ms
66,788 KB
testcase_36 AC 41 ms
68,132 KB
testcase_37 AC 40 ms
66,824 KB
testcase_38 AC 39 ms
67,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = list(input())
D = int(input())
cnt, s = 0, 0
for t in T:
    if t == "?":
        cnt += 1
    else:
        s += int(t)
if s:
    s %= 9
    if s == 0:
        s = 9

if D == 0:
    if s == 0:
        print(1)
    else:
        print(0)
    exit()

mod = 10 ** 9 + 7
ans = pow(10, cnt, mod) - 1
ans *= pow(9, mod - 2, mod)
if s == D:
    ans += 1
print(ans%mod)
0