結果

問題 No.1085 桁和の桁和
ユーザー tanon710tanon710
提出日時 2020-06-19 23:11:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 501 bytes
コンパイル時間 417 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 76,800 KB
最終ジャッジ日時 2023-09-30 06:27:19
合計ジャッジ時間 5,431 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,392 KB
testcase_01 AC 73 ms
71,156 KB
testcase_02 AC 73 ms
71,408 KB
testcase_03 AC 74 ms
71,332 KB
testcase_04 AC 77 ms
75,620 KB
testcase_05 AC 75 ms
71,164 KB
testcase_06 AC 75 ms
71,120 KB
testcase_07 AC 73 ms
71,308 KB
testcase_08 AC 74 ms
71,320 KB
testcase_09 AC 73 ms
71,392 KB
testcase_10 AC 73 ms
71,160 KB
testcase_11 AC 74 ms
71,160 KB
testcase_12 AC 72 ms
71,372 KB
testcase_13 AC 82 ms
76,500 KB
testcase_14 AC 91 ms
76,388 KB
testcase_15 AC 100 ms
76,584 KB
testcase_16 AC 98 ms
76,572 KB
testcase_17 AC 88 ms
76,328 KB
testcase_18 AC 84 ms
76,528 KB
testcase_19 AC 96 ms
76,500 KB
testcase_20 AC 80 ms
76,248 KB
testcase_21 AC 90 ms
76,496 KB
testcase_22 AC 93 ms
76,292 KB
testcase_23 AC 81 ms
76,532 KB
testcase_24 WA -
testcase_25 AC 90 ms
76,320 KB
testcase_26 AC 96 ms
76,324 KB
testcase_27 AC 93 ms
76,424 KB
testcase_28 AC 100 ms
76,340 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 96 ms
76,332 KB
testcase_32 AC 92 ms
76,612 KB
testcase_33 AC 119 ms
76,340 KB
testcase_34 AC 125 ms
76,280 KB
testcase_35 AC 121 ms
76,368 KB
testcase_36 AC 119 ms
76,412 KB
testcase_37 AC 120 ms
76,608 KB
testcase_38 AC 120 ms
76,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=10**9+7
t=input()
d=int(input())
tmp=0
cnt=0
for c in t:
    if c=='?':
        cnt+=1
    else:
        tmp+=int(c)
if d!=0:
    if tmp!=0 and tmp%9==0:
        tmp=9
    coef=0
    for i in range(cnt):
        coef+=pow(10,i,mod)
        coef%=mod
    coef=[1]+[coef]*9
    ans=0
    if tmp==d:
        ans+=1
    for i in range(1,10):
        if (tmp+i-d)%9==0:
            ans+=coef[i]
            ans%=mod
    print(ans%mod)
if d==0:
    if tmp!=0:
        print(0)
    else:
        print(1)
0