結果

問題 No.1085 桁和の桁和
ユーザー tyawanmusityawanmusi
提出日時 2020-01-20 19:01:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 593 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 10,856 KB
実行使用メモリ 8,504 KB
最終ジャッジ日時 2023-09-30 06:00:33
合計ジャッジ時間 2,451 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 14 ms
7,860 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 33 ms
8,340 KB
testcase_05 AC 14 ms
7,812 KB
testcase_06 AC 14 ms
7,852 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 14 ms
7,788 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 38 ms
8,336 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10**9 + 7
s=input()
d=int(input())
digit_sum=0
blind_count=0
for i in range(len(s)):
  if s[i]=="?":
    blind_count+=1
  else:
    digit_sum+=int(s[i])
    while digit_sum>9:
      digit_sum-=9
n=blind_count
r=[n]
l=[n+1]
d=[d]


def calc(l, r, di, dj):
  if dj == 0:
    if di == 0:
      return 1
    else:
      return 0
  else:
    ans_r = pow(10, r, mod) * pow(9, mod - 2, mod)
    ans_l = pow(10, l, mod) * pow(9, mod - 2, mod)
    ans=(ans_r + (mod - ans_l)) % mod
    if di == dj:
      ans += 1
      ans %= mod
    return ans
ans = calc(l[0], r[0], digit_sum, d[0])
print(ans)
0