📜  python在线编译器3.8——Python代码示例

📅  最后修改于: 2022-03-11 14:46:05.997000             🧑  作者: Mango

代码示例6
def Find_It(N, X, K, S):
    S=list(s)
    chunks = [S[i:i + X] for i in chunks]
    numbers = [sorted(set(i)) for i in chunks]
    occur = [len(x) for x in numbers]
    for i in range(len(occur) - 2, -1, -1):
        occur[i] = occur[i] * occur[i + 1]
    if k > occur[0]:
      return -1
    occur.append(1)
    res = []
    K = K -1
    for i in range (1, len(occur)):
        div = k // occur[i]
        res.append(numbers[i - 1][div])
        K = K % occur[i]
    print(''.join(res))
    
    
    
x = input();
y = input();
z=[]
a=[]
z = x. split ('');
for i in z:
    a.append(int(i))
Find_It(a[0], a[1], a[2],y)