QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#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)
Details
answer.code:1:1: error: ‘from’ does not name a type 1 | from itertools import permutations | ^~~~