/ SeriousOJ /

Record Detail

Compile Error

foo.c:1:1: error: unknown type name 'def'
    1 | def max_number(arr, k):
      | ^~~
foo.c: In function 'max_number':
foo.c:1:23: error: expected declaration specifiers before ':' token
    1 | def max_number(arr, k):
      |                       ^

Code

def max_number(arr, k):
    arr.sort(reverse=True)
    n = len(arr)
    for _ in range(k):
        arr[-2] = str(arr[-2]) + str(arr[-1])
        arr.pop()
    return int(arr[-1])

t = int(input())
for _ in range(t):
    n, k = map(int, input().split())
    arr = list(map(int, input().split()))
    print(max_number(arr, k))

Information

Submit By
Type
Pretest
Problem
P1083 Number concatenation
Language
C99 (GCC 13.2.0)
Submit At
2024-08-16 15:56:37
Judged At
2024-08-16 15:56:37
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes