結果
問題 |
No.1085 桁和の桁和
|
ユーザー |
|
提出日時 | 2020-06-19 23:11:27 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 501 bytes |
コンパイル時間 | 707 ms |
コンパイル使用メモリ | 82,460 KB |
実行使用メモリ | 67,816 KB |
最終ジャッジ日時 | 2024-07-23 00:39:44 |
合計ジャッジ時間 | 4,350 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 WA * 3 |
ソースコード
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)