ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#213417 | #2355. Digit | jsxheng | 100 | 1202ms | 9204kb | Python3 | 638b | 2024-11-11 21:48:41 | 2024-11-11 23:08:51 |
answer
def A(dist, start, startValue, traverse):
from heapq import heappop, heappush
dist[start] = startValue
queue = [(startValue, start)]
while queue:
value, node = heappop(queue)
if dist[node] == value:
for node2, value2 in traverse(node, value):
if dist[node2] > value2:
dist[node2] = value2
heappush(queue, (value2, node2))
return dist
def B(n):
def traverse(remainder, add1):
return [((remainder*10)%n, add1), ((remainder+1)%n, add1+1)]
return A([n+1]*n, 1%n, 1, traverse)[0]
n=int(input())
print(B(n))
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 138ms
memory: 6740kb
input:
81920
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 10
Accepted
time: 115ms
memory: 8616kb
input:
55966
output:
2
result:
ok 1 number(s): "2"
Test #3:
score: 10
Accepted
time: 182ms
memory: 9204kb
input:
92661
output:
3
result:
ok 1 number(s): "3"
Test #4:
score: 10
Accepted
time: 121ms
memory: 6312kb
input:
68013
output:
18
result:
ok 1 number(s): "18"
Test #5:
score: 10
Accepted
time: 125ms
memory: 6352kb
input:
72927
output:
27
result:
ok 1 number(s): "27"
Test #6:
score: 10
Accepted
time: 35ms
memory: 5852kb
input:
15047
output:
5
result:
ok 1 number(s): "5"
Test #7:
score: 10
Accepted
time: 97ms
memory: 5948kb
input:
59994
output:
36
result:
ok 1 number(s): "36"
Test #8:
score: 10
Accepted
time: 179ms
memory: 8212kb
input:
97273
output:
10
result:
ok 1 number(s): "10"
Test #9:
score: 10
Accepted
time: 110ms
memory: 6476kb
input:
51139
output:
14
result:
ok 1 number(s): "14"
Test #10:
score: 10
Accepted
time: 100ms
memory: 6736kb
input:
55788
output:
15
result:
ok 1 number(s): "15"
Extra Test:
score: 0
Extra Test Passed