Problem: There is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.  On this sequence, Snuke can perform the following operation:    * Choose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.  Snuke would like to make all the elements in this sequence equal by repeating the operation above some number of times. Find the minimum number of operations required. It can be proved that, Under the constraints of this problem, this objective is always achievable.

Submission attempts (in order):

K = int(input())
aaa = 1
ans_array = []

def sunuke(n):
    re = 0
    tmp = n
    while n:
        re += n % 10
        n = n//10
    re = tmp/re
    print(re)

def print_sunuke():
    global aaa
    num = aaa % 10
    if num == 0:
        aaa += 1
        print_sunuke()
        return
    nine = aaa // 10
    ans = str(num) + "9" * nine
    aaa += 1
    ans_array.append(int(ans))




for i in range(10000):

    print_sunuke()

ans_array.append(1899)
ans_array.append(2899)
ans_array.append(3899)
ans_array.append(4899)
ans_array.append(5899)
ans_array.append(6899)
ans_array.append(7899)
ans_array.append(8899)
ans_array.append(9899)
ans_array.append(18999)
ans_array.append(28999)
ans_array.append(38999)
ans_array.append(48999)
ans_array.append(58999)
ans_array.append(68999)
ans_array.append(78999)
ans_array.append(88999)
ans_array.append(98999)
ans_array.append(189999)
ans_array.append(289999)
ans_array.append(389999)
ans_array.append(489999)
ans_array.append(589999)
ans_array.append(689999)
ans_array.append(789999)
ans_array.append(889999)
ans_array.append(989999)
ans_array.append(1899999)
ans_array.append(2899999)
ans_array.append(3899999)
ans_array.append(4899999)
ans_array.append(5899999)
ans_array.append(6899999)
ans_array.append(7899999)
ans_array.append(8899999)
ans_array.append(9899999)

ans_array.append(18999999)
ans_array.append(28999999)
ans_array.append(38999999)
ans_array.append(48999999)
ans_array.append(58999999)
ans_array.append(68999999)
ans_array.append(78999999)
ans_array.append(88999999)
ans_array.append(98999999)

ans_array.append(189999999)
ans_array.append(289999999)
ans_array.append(389999999)
ans_array.append(489999999)
ans_array.append(589999999)
ans_array.append(689999999)
ans_array.append(789999999)
ans_array.append(889999999)
ans_array.append(989999999)
ans_array.append(1899999999)
ans_array.append(2899999999)
ans_array.append(3899999999)
ans_array.append(4899999999)
ans_array.append(5899999999)
ans_array.append(6899999999)
ans_array.append(7899999999)
ans_array.append(8899999999)
ans_array.append(9899999999)

ans_array.append(18999999999)
ans_array.append(28999999999)
ans_array.append(38999999999)
ans_array.append(48999999999)
ans_array.append(58999999999)
ans_array.append(68999999999)
ans_array.append(78999999999)
ans_array.append(88999999999)
ans_array.append(98999999999)


ans_array.sort()

for i in range(K):
    print(ans_array[i])





# n = int(input())
N, K = map(int, input().split())
A = list(map(int, input().split()))
# d = [list(map(int, input().split())) for _ in range(n)]


if (N-1)%(K-1):
    ans =(N-1)//(K-1)+1
else:
    ans = (N-1) // (K - 1)


print(ans)


# K = int(input())




Verdicts: Runtime Error

Accepted