結果
問題 | No.1085 桁和の桁和 |
ユーザー | vwxyz |
提出日時 | 2021-08-11 23:52:15 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 963 bytes |
コンパイル時間 | 522 ms |
コンパイル使用メモリ | 81,880 KB |
実行使用メモリ | 90,172 KB |
最終ジャッジ日時 | 2023-10-26 01:53:33 |
合計ジャッジ時間 | 12,721 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 154 ms
88,812 KB |
testcase_01 | WA | - |
testcase_02 | AC | 156 ms
88,808 KB |
testcase_03 | AC | 160 ms
89,712 KB |
testcase_04 | WA | - |
testcase_05 | AC | 156 ms
89,668 KB |
testcase_06 | AC | 152 ms
88,832 KB |
testcase_07 | AC | 152 ms
88,836 KB |
testcase_08 | AC | 152 ms
88,836 KB |
testcase_09 | WA | - |
testcase_10 | AC | 153 ms
88,840 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 185 ms
89,764 KB |
testcase_14 | AC | 240 ms
89,828 KB |
testcase_15 | AC | 332 ms
89,860 KB |
testcase_16 | AC | 328 ms
89,860 KB |
testcase_17 | AC | 241 ms
89,828 KB |
testcase_18 | AC | 200 ms
89,764 KB |
testcase_19 | AC | 314 ms
89,828 KB |
testcase_20 | WA | - |
testcase_21 | AC | 264 ms
89,828 KB |
testcase_22 | AC | 310 ms
89,824 KB |
testcase_23 | AC | 174 ms
89,760 KB |
testcase_24 | AC | 165 ms
89,764 KB |
testcase_25 | AC | 249 ms
89,828 KB |
testcase_26 | AC | 342 ms
89,856 KB |
testcase_27 | AC | 302 ms
89,824 KB |
testcase_28 | AC | 363 ms
89,856 KB |
testcase_29 | AC | 268 ms
89,824 KB |
testcase_30 | AC | 264 ms
89,824 KB |
testcase_31 | AC | 339 ms
89,856 KB |
testcase_32 | AC | 275 ms
89,828 KB |
testcase_33 | AC | 264 ms
89,924 KB |
testcase_34 | AC | 266 ms
89,920 KB |
testcase_35 | AC | 269 ms
89,924 KB |
testcase_36 | AC | 270 ms
89,924 KB |
testcase_37 | AC | 271 ms
89,924 KB |
testcase_38 | AC | 271 ms
89,924 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())%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)