QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#103287#5460. Sum of NumbersAlpha_Q#Compile Error//C++17472b2023-05-05 03:59:282023-05-05 03:59:31

Judging History

This is the latest submission verdict.

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-05 03:59:31]
  • Judged
  • [2023-05-05 03:59:28]
  • Submitted

answer

t = int(input())

for _ in range(t):
  n, k = map(int, input().split())
  s = input()
  k += 1
  same, extra = n // k, n % k
  ans = int(s)
  for mask in range(0, 1 << k):
    if bin(mask).count('1') != extra:
      continue
    sizes = [same] * k
    for i in range(0, k):
      if mask & 1 << i:
        sizes[i] += 1
    at, total = 0, 0
    for l in sizes:
      total += int(s[at : at + l])
      at += l
    ans = min(ans, total)
  print(ans)


Details

answer.code:1:1: error: ‘t’ does not name a type
    1 | t = int(input())
      | ^