結果
| 問題 |
No.1085 桁和の桁和
|
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2023-08-01 12:35:07 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 51 ms / 2,000 ms |
| コード長 | 366 bytes |
| コンパイル時間 | 180 ms |
| コンパイル使用メモリ | 82,060 KB |
| 実行使用メモリ | 68,304 KB |
| 最終ジャッジ日時 | 2024-10-11 04:24:07 |
| 合計ジャッジ時間 | 3,126 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 35 |
ソースコード
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)
rlangevin