Reason for runtime error in my python code?

Правка en1, от adarshj322, 2020-05-09 11:18:11

Can anyone explain the reason for runtime error in my python code

def solve(s,n,k):
	s = sorted(s)
	s = "".join(s)
	if s[0] != s[k-1]:
		print(s[k-1])
		return
	print(s[0],end ="")
	if s[k] != s[n-1]:
		print(s[k:])
	else:
		r = (n-1)//k
		print(s[n-1]*r)

t = int(input())
for _ in range(t):
	n,k = map(int,input().split())
	s = input()
	solve(s,n,k)
	

for the problem phoenix and distribution

Теги #constructive algorithms, #638

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский adarshj322 2020-05-09 11:18:11 532 Initial revision (published)