結果

問題 No.1085 桁和の桁和
コンテスト
ユーザー rlangevin
提出日時 2023-08-01 12:35:07
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 35 ms / 2,000 ms
+ 504µs
コード長 366 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 73 ms
コンパイル使用メモリ 80,640 KB
実行使用メモリ 69,504 KB
最終ジャッジ日時 2026-09-13 18:03:06
合計ジャッジ時間 3,705 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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