QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#524860 | #5460. Sum of Numbers | solar_express# | Compile Error | / | / | C++14 | 413b | 2024-08-20 09:49:38 | 2024-08-20 09:49:38 |
Judging History
answer
from itertools import permutations
T = int(input())
for _ in range(T):
n, k = map(int, input().split())
s = input()
ans = int(s)
k = min(k, n-1)+1
u = n//k
r = n % k
grp = [u]*(k-r)+[u+1]*r
for lst in permutations(grp):
i = 0
cur = 0
for x in lst:
cur += int(s[i:i+x])
i+=x
ans = min(ans, cur)
print(ans)
詳細信息
answer.code:1:1: error: ‘from’ does not name a type 1 | from itertools import permutations | ^~~~