結果
問題 | No.1085 桁和の桁和 |
ユーザー | vwxyz |
提出日時 | 2021-08-11 23:53:45 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,044 bytes |
コンパイル時間 | 2,010 ms |
コンパイル使用メモリ | 81,360 KB |
実行使用メモリ | 89,976 KB |
最終ジャッジ日時 | 2023-10-26 01:54:35 |
合計ジャッジ時間 | 10,392 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 126 ms
88,860 KB |
testcase_01 | AC | 127 ms
88,856 KB |
testcase_02 | AC | 129 ms
88,864 KB |
testcase_03 | AC | 138 ms
89,784 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 131 ms
88,880 KB |
testcase_07 | AC | 128 ms
88,884 KB |
testcase_08 | AC | 131 ms
88,884 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 158 ms
89,820 KB |
testcase_14 | AC | 208 ms
89,884 KB |
testcase_15 | AC | 292 ms
89,912 KB |
testcase_16 | AC | 292 ms
89,916 KB |
testcase_17 | AC | 214 ms
89,884 KB |
testcase_18 | AC | 175 ms
89,816 KB |
testcase_19 | AC | 279 ms
89,884 KB |
testcase_20 | AC | 130 ms
88,884 KB |
testcase_21 | AC | 227 ms
89,880 KB |
testcase_22 | AC | 270 ms
89,884 KB |
testcase_23 | AC | 150 ms
89,816 KB |
testcase_24 | AC | 139 ms
89,820 KB |
testcase_25 | AC | 232 ms
89,884 KB |
testcase_26 | AC | 297 ms
89,916 KB |
testcase_27 | AC | 265 ms
89,880 KB |
testcase_28 | AC | 325 ms
89,916 KB |
testcase_29 | AC | 233 ms
89,884 KB |
testcase_30 | AC | 235 ms
89,884 KB |
testcase_31 | AC | 305 ms
89,916 KB |
testcase_32 | AC | 251 ms
89,884 KB |
testcase_33 | AC | 235 ms
89,976 KB |
testcase_34 | AC | 238 ms
89,976 KB |
testcase_35 | AC | 252 ms
89,976 KB |
testcase_36 | AC | 244 ms
89,968 KB |
testcase_37 | AC | 252 ms
89,972 KB |
testcase_38 | AC | 245 ms
89,972 KB |
ソースコード
import bisect import copy import decimal import fractions import functools import heapq import itertools import math import random import sys from collections import Counter,deque,defaultdict from functools import lru_cache,reduce from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max def _heappush_max(heap,item): heap.append(item) heapq._siftdown_max(heap, 0, len(heap)-1) def _heappushpop_max(heap, item): if heap and item < heap[0]: item, heap[0] = heap[0], item heapq._siftup_max(heap, 0) return item from math import gcd as GCD read=sys.stdin.read readline=sys.stdin.readline readlines=sys.stdin.readlines S=readline().rstrip() D=int(readline()) if D==0: ans=0 else: D%=9 mod=10**9+7 dp=[0]*9 dp[0]=1 for s in S[::-1]: prev=dp dp=[0]*9 for i in range(9): for j in range(10): if s=="?" or int(s)==j: dp[(i+j)%9]+=prev[i] dp[(i+j)%9]%=mod ans=dp[D] print(ans)