Problem:


Score : 500 points

Problem Statement

Let S(n) denote the sum of the digits in the decimal notation of n.
For example, S(123) = 1 + 2 + 3 = 6.

We will call an integer n a Snuke number when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds.

Given an integer K, list the K smallest Snuke numbers.

Constraints

1 \leq K

The K-th smallest Snuke number is not greater than 10^{15}.

Input

Input is given from Standard Input in the following format:

K

Output

Print K lines. The i-th line should contain the i-th smallest Snuke number.

Sample Input 1

10

Sample Output 1

1
2
3
4
5
6
7
8
9
19



Sample input:
10


Sample output:
1
2
3
4
5
6
7
8
9
19

Submission status: Wrong Answer

Solution code:
from math import log
def S(n):
    ans = 0
    while n != 0:
        ans += n % 10 
        n //= 10
    return ans
def get_snuke(n):
    return n / S(n)
def get_snuke2(n):
    return log(n) - log( S(n) ) 

def get_keta(n):
    keta = 0
    while n:
        keta += 1
        n //= 10
    return keta
ans = [1]
from collections import deque
from copy import copy
def nexta(K):
    if K == 1:
        return ans[0]

    listInt= []
    bef = ans[K-2]

    while bef:
        listInt.append(bef % 10)
        bef //= 10

    # bef = list(reverse(bef))
    # for i in range(len(bef)-1, -1, -1):
    for i in range(len(listInt)):
        if listInt[i] != 9:
            break
    
    if i == len(listInt)-1 and listInt[i] == 9:
        # ALL 9 
        action5 = copy(listInt)
        action5.append(1)
        action6 = copy(listInt)
        action6.append(9)
        action1 = action5
        action2 = action5
        action3 = action5
        # action4 = action5
        action4 = copy(listInt)
        # action4[i] = "01"
        action4[i] += 1

    else:
        action1 = copy(listInt)
        action1[i] += 1

        action2 = copy(listInt)
        action2[i] = 9
        
        action3 = copy(listInt)
        action3[i] = 9
        if i == len(listInt) -1 :
            action3.append(1)
        # elif i != len(listInt)-1 and action3[i] == 9:
        #     pass
            

        action4 = copy(listInt)
        action4[i] = 9
        if i == len(listInt) -1 :
            action3.append(9)



        action5 = action1
        action6 = action1
        # elif i != len(listInt)-1 and action3[i] == 9:
        #     pass
    # action1_num = int(

    action1 = list(reversed(action1))
    action1 = list(map(lambda x: str(x), action1))
    action2 = list(reversed(action2))
    action2 = list(map(lambda x: str(x), action2))
    action3 = list(reversed(action3))
    action3 = list(map(lambda x: str(x), action3))
    action4 = list(reversed(action4))
    action4 = list(map(lambda x: str(x), action4))
    action5 = list(reversed(action5))
    action5 = list(map(lambda x: str(x), action5))
    action6 = list(reversed(action6))
    action6 = list(map(lambda x: str(x), action6))

    actions = [action1, action2, action3, action4, action5, action6]
    # print("actions: ", actions)
    minvalue = 10**9
    mini = -1

    for e,act in enumerate(actions):
        if minvalue > get_snuke2(int("".join(act))):
            mini = e
            minvalue = get_snuke2(int("".join(act)))
    # print("mini: ", mini, actions[mini])

    ans.append(int("".join(actions[mini])))# get_snukeactions[mini]

    return 

K = int(input())
for i in range(1,K+1):
    nexta(i)
# print(ans)
print("\n".join(list(map(lambda x: str(x), ans[:K]))))
            

exit(0)

Submission status: Wrong Answer

Solution code:
# import collections
K = int(input())

# def snuke(n):
#     S = 0
#     for i in str(n):
#         S+=int(i)
#     return n/S

# b = 9
# m = 1
# while True:
#     if b>1e5:
#         break
    
#     if snuke(b)>=m:
#         print(b,snuke(b))
#         m = snuke(b)
#     b += 10

for i in range(1,10):
    print(i)
    K-=1
    if K==0:
        exit()

n=1
while K>0:
    if n%10==9:
        n+=1
    print(((n+1)%10)*10**(n//10+1)-1)
    K-=1
    n+=1

Submission status: Wrong Answer

Solution code:
# import collections
K = int(input())

def snuke(n):
    S = 0
    for i in str(n):
        S+=int(i)
    return n/S

# while True:
#     b = a+10
#     if b>1e7:
#         break
#     if snuke(b)>=m:
#         print(b,snuke(b))
#         m = snuke(b)
#     a = b

for i in range(1,10):
    print(i)
    K-=1
    if K==0:
        exit()

n=0
while K>0:
    if n%10==9:
        n+=1
    print(((n+1)%10)*10**(n//10+1)+9)
    K-=1
    n+=1

Submission status: Wrong Answer

Solution code:
serch_table = []

for i in range(100):
    for j in range(1,100):
        x = str(j) + '9'*i
        x = int(x)
        serch_table.append(x)
#print(serch_table)

L = []
for i in serch_table:
    l = [x for x in str(i)]
    x = sum(map(int,l))
    l = [i/x,i]
    L.append(l)
L= sorted(L)
M = []
tmp = -1
for i in L:
    if tmp < i[1]:
        M.append(i[1])
        tmp = i[1]
#print(M,len(serch_table ))
N = int(input())
for i in range(N):
    print(M[i])

Submission status: Wrong Answer

Solution code:
def fn(x):
    denom = 0
    for c in str(x):
        denom += int(c)
    return float(x)/denom

k = int(input())
digit = 0
suf = 1
ans = 0
while ans<k:
    sn1 = (suf+1) * 10 ** digit  -1
    sn2 = (suf+2) * 10 ** digit - 1
    if fn(sn1) <= fn(sn2):
        suf += 1
        ans+=1
        print(sn1)
    else:
        digit = len(str(sn1))-1
        suf = 1

Submission status: Wrong Answer

Solution code:
K = int(input())

a = (K - 1) // 9 
b = K % 9

for i in range(a):
    for j in range(1, 10):
        print(int(str(j) + '9' * i))
        
if b != 0:
    for j in range(1, b + 1):
        print(int(str(j) + '9' * a))

Submission status: Wrong Answer

Solution code:
iii=int(input())
sunukenumber=0


while sunukenumber<iii:

  sunukenumber=sunukenumber+1
  
  print((sunukenumber%9)*(sunukenumber%9!=0)+9*(sunukenumber%9==0),end="")
  for m2 in range(0,(sunukenumber-1)//9):print("9",end="")
  print()

Submission status: Wrong Answer

Solution code:
iii=int(input())
sunukenumber=0
counter=0

sn=0
max=0


while sunukenumber<iii:

  sunukenumber=sunukenumber+1
  counter=counter+1
  
  if counter!=10:
    print((counter)%10,end="")
    for m2 in range(0,(sunukenumber-1)//9):print("9",end="")
    print()
  else: counter=0; sunukenumber=sunukenumber-1

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

def main():
    K = int(input())

    i = 1
    n = 0
    k = K
    while 0 < k:
        print(str(i) + ('9' * n))
        k -= 1
        i += 1
        if i == 10:
            i = 1
            n += 1



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
K = int(input())

#for i in range(1, 1001):
#    tmp = i
#    s = 0
#    while tmp >= 10:
#        s += tmp%10
#        tmp //= 10
#    s += tmp
#    print(i, i/s)
mag = 1
cnt = 0
ans = 0
for _ in range(K):
    ans += mag
    cnt += 1
    if cnt==9:
        mag *= 10
        cnt = 0
    print(ans)

Submission status: Wrong Answer

Solution code:
K = int(input())
j = 1
Flag = False
while(K > 0):
    for k in range(1, 10):
        if(Flag):
            print(k * 10 ** (j-1) - 1)
            K -= 1
            if(K == 0):
                break
        else:
            Flag = True
    j += 1

Submission status: Wrong Answer

Solution code:
K = 20
j = 1
Flag = False
while(K > 0):
    for k in range(1, 10):
        if(Flag):
            print(k * 10 ** (j-1) - 1)
            K -= 1
            if(K == 0):
                break
        else:
            Flag = True
    j += 1

Submission status: Wrong Answer

Solution code:
K = int(input())
j = 1
Flag = False
while(K > 0):
    for k in range(1, 10):
        if(Flag):
            print(k, K, k * 10 ** (j-1) - 1)
            K -= 1
            if(K == 0):
                break
        else:
            Flag = True
    j += 1

Submission status: Wrong Answer

Solution code:
K = int(input())
i = 1
while(K > 0):
    print(i)
    K -= 1
    i += 1
    if(i == 10):
        i = 19
        break
    
while(K > 0):
    print(i)
    K -= 1
    i += 10

Submission status: Wrong Answer

Solution code:
k = int(input())

if k <= 9:
    for i in range(1, k+1):
        print(i)

elif k <= 18:
    for i in range(1, 10):
        print(i)
    for i in range(1, k-8):
        print(i*10+9)

else:
    for i in range(1, 10):
        print(i)
    for i in range(1, 10):
        print(10*i+9)

Submission status: Wrong Answer

Solution code:
K = int(input())

syou = K // 9
amari = K % 9

count = 0

for i in range(syou):
    for j in range(1,10):
        count += 10**i
        print(count)

for k in range(amari):
    count += 10**(i+1)
    print(count)

Submission status: Wrong Answer

Solution code:
k = int(input())
sunuke_list = [1,2,3,4,5,6,7,8]
def s(n):
    n_charlist = list(str(n))
    return sum(list(map(int, n_charlist)))
def combine_int(i,n):
    i_charlist = list(str(i))
    n_charlist = ['9'] * n
    ret_charlist = i_charlist + n_charlist
    ret_str = ''.join(ret_charlist)
    return int(ret_str)
for n in range(1,14):
    i = n-1
    while((i+1)/(s(i)+9*n) <= (i+2)/(s(i+1)+9*n)):
        sunuke_list.append(combine_int(i,n))
        i += 1
for i in range(k):
    print(sunuke_list[i])

Submission status: Wrong Answer

Solution code:
k = int(input())


list_index = []
i = 1
while(True):
    if i < 10:
        list_index.append(i)
    else:
        ans = (i%10+1)*(10**(i//10))-1
        list_index.append(ans)
    i += 1
    if len(set(list_index)) == k:
        break
list_index = sorted(set(list_index))

for number in list_index:
    print(number)

Submission status: Wrong Answer

Solution code:
import numpy as np

k = int(input())


list_index = []
for i in range(1,k+1+round(k/10)):
    if i < 10:
        list_index.append(i)
    else:
        ans = (i%10+1)*(10**(i//10))-1
        list_index.append(ans)
list_index = sorted(set(list_index))
for number in list_index:
    print(number)

Submission status: Wrong Answer

Solution code:
k = int(input())

list_index = []
for i in range(1,k+1):
    if i < 10:
        list_index.append(i)
    else:
        ans = (i%10+1)*(10**(i//10))-1
        list_index.append(ans)
list_index = sorted(set(list_index))
for number in list_index:
    print(number)

Submission status: Wrong Answer

Solution code:
#import matplotlib.pyplot as plt

k = int(input())
"""
x = []
for i in range(1,k):
    str_number = list(map(int,str(i)))
    sum_number = sum(str_number)
    sunuke = i /float(sum_number)
    x.append(sunuke)
    print(i,":",sunuke)

plt.figure()
plt.plot(x)
plt.show()
"""

for i in range(1,k+1):
    if i < 10:
        print(i)
    else:
        print(10*(i-9)+9)

Submission status: Wrong Answer

Solution code:
from math import log10 as l
s=lambda f:sum(map(int,list(str(f))))
p=lambda a,j:(a//10**(j+1)+1)*10**(j+1)-1
n=int(input())
a=1
for i in range(n):
  print(a)
  if(a<10):
    a+=1
    continue
  a+=1
  k=[p(a,j) for j in range(int(l(a)))]
  o=[p(a,j)/s(p(a,j)) for j in range(int(l(a)))]
  a=k[o.index(min(o))]

Submission status: Wrong Answer

Solution code:
n=int(input())
c=0
if(n<28):
  for i in range(1,n+1):
    print((i%9+1)*10**(i//9)-1)
else:
  for i in range(1,28):
    print((i%9+1)*10**(i//9)-1)
  for i in range(28,n+1):
    if(c==n-27):
      break
    x=i//9
    y=i%9
    j=(y+1)*10**x-1
    k=(((i+1)%9+1)*10**((i+1)//9)-1)/(i+1)
    for l in range(1000):
      if(sum(map(int,list(str(l))))==18+y):
        a=(l+1)*10**(x-2)-1
        if(a/i<=k):
          c+=1
          print(a)

Submission status: Wrong Answer

Solution code:
for i in range(1,int(input())+1):
  print((i%9+1)*10**(i//9)-1)

Submission status: Wrong Answer

Solution code:
k = int(input())
a = [1,2,3,4,5,6,7,8,9,19]
for i,j in enumerate(a):
  print(j)
  if i == (k-1):
    break

Submission status: Wrong Answer

Solution code:
import math
K = int(input())
i = 0
ans = 1
while i < K:
  len = int(math.log10(ans)+1)-1
  print(ans)
  if ans < 10:
    if ans == 9:
      ans+=10
    else:
      ans+=1
  elif ans <100:
    if ans == 99:
      ans+=100
    else:
      ans+=10
  else:
    ans+=100
  
  i+=1

Submission status: Wrong Answer

Solution code:
import math
K = int(input())
i = 0
ans = 1
while i < K:
  len = int(math.log10(ans)+1)-1
  print(ans)
  if ans == 10**(len+1) - 1:
    ans+=10**(len+1)
  else:
    ans+=10**len
  i+=1

Submission status: Wrong Answer

Solution code:
K = int(input())

num_block = K // 9
num_rest = K % 9

for base in range(num_block):
    num_base = 10**base
    for j in range(1, 10):
        print((j + 1) * num_base - 1)

num_base = 10**num_block
for j in range(1, num_rest + 1):
    print((j + 1) * num_base - 1)

Submission status: Wrong Answer

Solution code:
def main():
    K = int(input())
    for i in range(K//9 + 1):
        for j in range(1, min(K - i*9, 9) + 1):
            print(str(j) + "9" * i)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    K = int(input())
    for i in range(1, min(K, 10)):
        print(i)
    cnt = 1
    while (9 + cnt) <= K:
        print("1" + "9" * cnt)
        cnt += 1


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    K = int(input())
    for i in range(1, max(K, 10)):
        print(i)
    cnt = 1
    while (9 + cnt) <= K:
        print("1" + "9" * cnt)
        cnt += 1


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import math
K=int(input())
k=0
m=0
def D(x):
  s=str(x)
  array=list(map(int,list(s)))
  return sum(array)
N=1
S=1
a=0
print(N)
while k<=K:
  N+=10**a
  S=D(N)
  if a<math.log10(N/S):
    a+=1
    N=(N//10**a+1)*10**a-1 
  S=D(N)
  print(N)
  k+=1

Submission status: Wrong Answer

Solution code:
K=int(input())
k=1
m=0
while k<=K:
  for n in range(2,11):
    print(n*10**m-1)
    k+=1
    if k>K:
      f=1
      break
  m+=1

Submission status: Wrong Answer

Solution code:
k = int(input())
j = 1
jcount = 1
for i in range(k):
    if i < 9:
        print(i + 1)
    else:
        if j == 10:
            j = 1
            jcount += 1
        print(str(j) + "9" * jcount)
        j += 1

Submission status: Wrong Answer

Solution code:
k = int(input())
j = 9
for i in range(k):
    if i < 9:
        print(i + 1)
    else:
        j += 10
        print(j)

Submission status: Wrong Answer

Solution code:
def S(x) :
    L = list(str(x))
    ans = 0
    for i in range(len(L)) :
        ans += int(L[i])
    return ans

N = int(input())
counter = 0
n = 1
m = n + 1
while counter != N :
    if n/m <= S(n)/S(m) :
        print(n)
        counter += 1
    n += 1
    m += 1

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 0
p = 1
for i in range(1,N+1) :
    if i % 9 == 1 and i >= 10 :
        p *= 10
    ans += p
    print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
L = list(str(N))
S = 0
for i in range(len(L)) :
    S += int(L[i])

q = 0
flag = 0
for i in range(N) :
    if (i+1)%10 == 0 :
        p = 1
        q += 1
        flag = 1
    else :
        p = (i+1)%10
    r = str(p)+"9"*q
    ans = int(r)
    if flag == 0 :
        print(ans)
    else :
        flag = 0

Submission status: Wrong Answer

Solution code:
N = int(input())
L = list(str(N))
S = 0
for i in range(len(L)) :
    S += int(L[i])

q = 0
for i in range(N) :
    if (i+1)%10 == 0 :
        p = 1
        q += 1
    else :
        p = (i+1)%10
    r = str(p)+"9"*q
    ans = int(r)
    print(ans)

Submission status: Wrong Answer

Solution code:
K = int(input())
for i in range(K):
    d, m = divmod(i, 9)    
    a = str(m + 1) + '9' * d
    print(a)

Submission status: Wrong Answer

Solution code:
K = int(input())
for i in range(min(K, 9)):
    print(i + 1)
for i in range(K - 9):
    print(10 * (i + 1) + 9)

Submission status: Wrong Answer

Solution code:
K = int(input())
cnt = 0
k = 0
while cnt < K:
  a = max(k - 1, 1)
  b = max(k, 1) * 10
  c = int('0' + ('9' * k))
  for i in range(a, b):
    print(i * 10 ** k + c)
    cnt += 1
    if cnt >= K:
      break
  k += 1

Submission status: Wrong Answer

Solution code:
K = int(input())
for i in range(1, K+1):
    pow = (i//9 - 1 if i%9==0 else i//9)
    mod = (9 if i%9==0 else i%9)
    ans = str(mod) + "9" * pow
    print(ans)

Submission status: Wrong Answer

Solution code:

a=input()
b=0
c=1
for x in range(int(a)):
    b+=1
    if b%(10**c)!=0:
        print(b)
    else:
        b=int("1"+"9"*c)
        c+=1
        print(b)

Submission status: Wrong Answer

Solution code:
K=int(input())
for i in range(3):
    for j in range(1,10):
        print(10**i*j+10**i-1)
        K-=1
        if K==0:
            break
    if K==0:
        break

if K!=0:
    for i in range(3,1000000):
        for j in range(1,10):
            if j < 3:
                for k in range(0,10):
                    print(10**i*j+10**(i-1)*(k+1)+-1)
                    K-=1
                    if K==0:
                        break
            else:
                continue
            if K==0:
                break
        if K==0:
            break

Submission status: Wrong Answer

Solution code:
K=int(input())
for i in range(3):
    for j in range(1,10):
        print(10**i*j+10**i-1)
        K-=1
        if K==0:
            break
    if K==0:
        break

if K!=0:
    for i in range(3,1000000):
        for j in range(1,10):
            for k in range(0,10):
                print(10**i*j+10**(i-1)*(k+1)+-1)
                K-=1
                if K==0:
                    break
            if K==0:
                break
        if K==0:
            break

Submission status: Wrong Answer

Solution code:
K=int(input())
for i in range(3):
    for j in range(1,10):
        print(10**i*j+10**i-1)
        K-=1
        if K==0:
            break
    if K==0:
        break

if K!=0:
    for i in range(3,1000000):
        for j in range(1,10):
            print(10**i+10**(i-1)*(j+1)-1)
            K-=1
            if K==0:
                break
        if K==0:
            break
        for j in range(2,10):
            print(10**i*(j+1)-1)
            K-=1
            if K==0:
                break
        if K==0:
            break

Submission status: Wrong Answer

Solution code:
K=int(input())
m=K//9+1
for i in range(m):
    for j in range(1,10):
        print(10**i*j+10**i-1)
        K-=1
        if K==0:
            break
    if K==0:
        break

Submission status: Wrong Answer

Solution code:
N = int(input())
M = N//9
k = N%9
d=0
for j in range (M):
    for i in range(2,11):
        print(i*10**d-1)
    d += 1 
for i in range(2,2+k):
        print(i*10**d-1)

Submission status: Wrong Answer

Solution code:
N = int(input())
M = N//10
k = N%10
d=0
for j in range (M):
    for i in range(2,11):
        print(i*10**d-1)
    d += 1 
if k != 0:
    for i in range(2,2+k):
        print(i*10**d-1)

Submission status: Wrong Answer

Solution code:
K = int(input())


def calc(n):
    str_n = list(str(n))
    return n / sum([int(i) for i in str_n])


digit = 1
for i in range(1, K+1):
    n = i % 9
    if n == 0:
        ans = "9" + "9" * (digit - 1)
        digit += 1
    else:
        ans = str(n) + "9" * (digit - 1)
    print(int(ans))

Submission status: Wrong Answer

Solution code:
# encoding: utf-8
import math

K = int(input())

def Sn(x):
    # print("###")
    digits = []
    N_tmp = x
    while N_tmp > 0:
        digits.append(N_tmp % 10)
        N_tmp = N_tmp // 10
    return sum(digits)

# list of Sunuke Numbers
N_snk_list = list(range(1, 10))
cnt = 9

# parallelogram ABCD ex) A(0, 0), B(9, 9), C(19, 10), D(10, 1)
x_A = 10
y_A = 1 # Sn(x_A // 10)
x_C = x_A + 19
y_C = 11 # Sn(x_C) = Sn(x_A // 10 + 1) + 9
while True:
    if (y_A + 9) / (x_A + 9) >= y_C / x_C:
        # print("##", x_A + 9)
        N_snk_list.append(x_A + 9)
        cnt += 1
    if cnt >= K: break
    # update x_A, x_C
    x_A += 10
    x_C += 10
    # update y_A
    if x_A % 100 == 0: y_A = Sn(x_A // 10)
    else: y_A += 1
    # update y_C
    if x_C % 100 == 9: y_C = Sn(x_C // 10 + 9) # oh...
    else: y_C += 1

if K < 10:
    for N_snk in range(1, K + 1): print(N_snk)
else:
    for N_snk in N_snk_list: print(N_snk)

Submission status: Wrong Answer

Solution code:
# encoding: utf-8
import math

K = int(input())

def Sn(x):
    # print("###")
    digits = []
    N_tmp = x
    while N_tmp > 0:
        digits.append(N_tmp % 10)
        N_tmp = N_tmp // 10
    return sum(digits)

# list of Sunuke Numbers
N_snk_list = list(range(1, 10))
cnt = 9

# parallelogram ABCD ex) A(0, 0), B(9, 9), C(19, 10), D(10, 1)
x_A = 10
y_A = 1 # Sn(x_A // 10)
x_C = x_A + 19
y_C = 11 # Sn(x_C) = Sn(x_A // 10 + 1) + 9
while True:
    # T : intersection of OC and AB
    # print("#", (x_A, y_A), (x_C, y_C), N_snk_list)
    # for n in range(math.floor(x_T), x_A + 10):
    #     if n > 0:
    #         N_snk_list.append(n)
    #         cnt += 1
    #     if cnt >= K: break
    if (y_A + 9) / (x_A + 9) >= y_C / x_C:
        # print("##", x_A + 9) # oh...
        N_snk_list.append(x_A + 9)
        cnt += 1
    if cnt >= K: break
    # update x_A, x_C
    x_A += 10
    x_C += 10
    # update y_A
    if x_A % 100 == 0: y_A = Sn(x_A // 10)
    else: y_A += 1
    # update y_C
    if x_C % 100 == 9: y_C = Sn(x_C // 10)
    else: y_C += 1

if K < 10:
    for N_snk in range(1, K + 1): print(N_snk)
else:
    for N_snk in N_snk_list: print(N_snk)

Submission status: Wrong Answer

Solution code:
# encoding: utf-8
import math

K = int(input())

def Sn(x):
    # print("###")
    digits = []
    N_tmp = x
    while N_tmp > 0:
        digits.append(N_tmp % 10)
        N_tmp = N_tmp // 10
    return sum(digits)

# list of Sunuke Numbers
N_snk_list = list(range(1, 10))
cnt = 9

# parallelogram ABCD ex) A(0, 0), B(9, 9), C(19, 10), D(10, 1)
x_A = 10
y_A = 1 # Sn(x_A // 10)
x_C = x_A + 19
y_C = 11 # Sn(x_C) = Sn(x_A // 10 + 1) + 9
while True:
    # T : intersection of OC and AB
    # print("#", (x_A, y_A), (x_C, y_C), N_snk_list)
    # for n in range(math.floor(x_T), x_A + 10):
    #     if n > 0:
    #         N_snk_list.append(n)
    #         cnt += 1
    #     if cnt >= K: break
    if (y_A + 9) / (x_A + 9) >= y_C / x_C:
        print("##", x_A + 9)
        N_snk_list.append(x_A + 9)
        cnt += 1
    if cnt >= K: break
    # update x_A, x_C
    x_A += 10
    x_C += 10
    # update y_A
    if x_A % 100 == 0: y_A = Sn(x_A // 10)
    else: y_A += 1
    # update y_C
    if x_C % 100 == 9: y_C = Sn(x_C // 10)
    else: y_C += 1

if K < 10:
    for N_snk in range(1, K + 1): print(N_snk)
else:
    for N_snk in N_snk_list: print(N_snk)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
D - Snuke Numbers
https://beta.atcoder.jp/contests/abc101/tasks/arc099_b
WA
"""
import sys
from sys import stdin
input = stdin.readline

Snuke = [1, 2, 3, 4, 5, 6, 7, 8, 9]
while True:
    tmp = Snuke[-9:]
    for i in tmp:
        t = int(str(i) + '9')
        Snuke.append(t)
    if Snuke[-1] > 10**15:
        break

def solve(K):
    return Snuke[:K]


def main(args):
    K = int(input())
    ans = solve(K)
    print(*ans, sep='\n')


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
D - Snuke Numbers
https://beta.atcoder.jp/contests/abc101/tasks/arc099_b

"""
import sys
from sys import stdin
input = stdin.readline


Snuke = [1, 2, 3, 4, 5, 6, 7, 8, 9]
nine = 1
while True:
    tmp = Snuke[-9:]
    for i in tmp:
        t = int(str(i) + '9'*nine)
        Snuke.append(t)
    nine += 1
    if Snuke[-1] > 10**15:
        break



def solve(K):
    return Snuke[:K]


def main(args):
    K = int(input())
    ans = solve(K)
    print(*ans, sep='\n')


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Wrong Answer

Solution code:
res = []
for digit in range(1,16):
    if digit<=3:
        for i in range(2,11):
            res.append(10**(digit-1)*i-1)
    elif 4<=digit<=12:
        for i in range(11,(digit-2)*10):
            res.append(i*10**(digit-2)-1)
        for i in range(digit-2,11):
            res.append(i*10**(digit-1)-1)
    elif digit==15:
        for i in range(101,110):
            res.append(i*10**(digit-3)-1)
        for i in range(11,101):
            res.append(i*10**(digit-2)-1)
    else:
        for i in range(11,101):
            res.append(i*10**(digit-2)-1)
print(res)

Submission status: Wrong Answer

Solution code:

K = int(input())

if K < 10:
    for i in range(K):
        print(i+1)
        
else:
    K -= 9
    for i in range(9):
        print(i+1)
    
    t = 0
    s = 10
    while K:
        t += 1
        print(s*(t+1) - 1)
        if t == 9:
            t = 0
            s *= 10
        K -= 1

Submission status: Wrong Answer

Solution code:

K = int(input())

if K < 10:
    for i in range(K):
        print(i+1)
        
else:
    K -= 9
    for i in range(9):
        print(i+1)
    
    t = 0
    while K:
        t += 1
        print(10*t + 9)
        K -= 1

Submission status: Wrong Answer

Solution code:
K = int(input())

if K < 11:
    for i in range(K):
        print(i+1)
        
else:
    K -= 10
    for i in range(10):
        print(i+1)
    
    t = 0
    while K:
        t += 1
        print(10*t + 9)
        K -= 1

Submission status: Wrong Answer

Solution code:
#coding: utf-8

m = 16
cnt = 0

k = int(raw_input())

for i in range(m):
    for j in range(1,10):
        n = (10**i)*j-1
        if n != 0:
            print n
            cnt += 1
            if cnt == k: exit()

Submission status: Wrong Answer

Solution code:
#coding: utf-8

m = 15
cnt = 0

k = int(raw_input())

for i in range(m):
    for j in range(1,10):
        n = (10**i)*j-1
        if n != 0:
            print n
            cnt += 1
            if cnt == k: exit()

Submission status: Wrong Answer

Solution code:
k = int(input())


i = 1
while i != k+1:
    if i <= 9:
        print(i)
    else:
        r = i % 9
        w = i // 9
        print((r+1)*(10**w)-1)
    i += 1

Submission status: Wrong Answer

Solution code:
K = int(input())
r = 0

for i in range(0, 10*100):
    for j in range(1, 9+1):
        S = str(j)+'0'*i
        if i == 0:
            k = int(S)
        else:
            k = int(S)+9
        if r <= K-1:
            print(k)
            r += 1
        else:
            break
    if r == K:
        break

Submission status: Wrong Answer

Solution code:
K = int(input())
r = 0

for i in range(0, 10*100):
    for j in range(1, 9+1):
        S = str(j)+'0'*i
        if i == 0:
            k = int(S)
        else:
            k = int(S)+9
        if k <= K:
            print(k)
            r += 1
        else:
            break
    if r == K:
        break

Submission status: Wrong Answer

Solution code:
def sum_digit(n):
    n_str = str(n)
    ans = 0
    for dig in n_str:
        ans += int(dig)
    return ans

K = int(input())

for i in range(K):
    k, a= divmod(i + 1, 9) #i + 1 = 9 * k + a
    print((a + 1) * (10 ** k) - 1)

Submission status: Wrong Answer

Solution code:
import sys 

K = int(input())

if K <= 0:
    sys.exit(0)

step = 1 
snuke = 1 

while K >= 0:
    if step < snuke/sum(map(int, str(snuke))):
        snuke += 9 * step
        step *= 10
    else:
        print(snuke)
        snuke += step
        K -= 1

Submission status: Wrong Answer

Solution code:
import sys 

K = int(input())

if K <= 0:
    sys.exit(0)

limit = 10 ** 15

for i in range(0, 16):
    for j in range(1, 10):
        if j < i-1:
            for k in range(min(10, K)):
                print(int(str(j) + str(k) + '9'*(i-1)))
            K -= k+1 
        else:
            print(str(j)+i*'9')
            K -= 1
        if K <= 0:
            break
    if K <= 0:
        break

Submission status: Wrong Answer

Solution code:
import sys

K = int(input())

if K <= 0:
    sys.exit(0)

limit = 10 ** 15

for i in range(1, 10):
    print(i)
    K -= 1
    if K == 0:
        break

for i in range(1, 16):
    for j in range(2, 11):
        if K == 0:
            break

        if j < i:
            for k in range(10):
                snuke = int(str(j-1) + str(k) + ''.join(['9' for l in range(i-1)]))
                if snuke >= limit:
                    print(limit)
                    sys.exit()
                else:
                    print(snuke)
                K -= 1
                if K == 0:
                    break
        else:
            snuke = (10 ** i) * j - 1
            if snuke >= limit:
                print(limit)
                sys.exit()
            else:
                print(snuke)
            K -= 1
    if K == 0:
        break

Submission status: Wrong Answer

Solution code:
import sys

K = int(input())

if K <= 0:
    sys.exit(0)

for i in range(1, 10):
    print(i)
    K -= 1
    if K == 0:
        break

for i in range(1, 16):
    for j in range(2, 11):
        if K == 0:
            break

        if i > 2 and j < i:
            for k in range(10):
                print(str(j-1) + str(k) + ''.join(['9' for l in range(i-1)]))
                K -= 1
                if K == 0:
                    break
        else:
            print((10 ** i) * j - 1)
            K -= 1
    if K == 0:
        break

Submission status: Wrong Answer

Solution code:
import sys

K = int(input())

if K == 0:
    sys.exit(0)

for i in range(1, 10):
    print(i)
    K -= 1
    if K == 0:
        break

for i in range(1, 16):
    for j in range(2, 10):
        if K == 0:
            break

        if i > 2 and j < i:
            for k in range(10):
                print(str(j-1) + str(k) + ''.join(['9' for l in range(i-1)]))
                K -= 1
                if K == 0:
                    break
        else:
            print((10 ** i) * j - 1)
            K -= 1
    if K == 0:
        break

Submission status: Wrong Answer

Solution code:
import sys 

K = int(input())

limit = 10 ** 15

if K == 0:
    sys.exit(0)

for i in range(1, 10):
    print(i)
    K -= 1
    if K == 0:
        break

for i in range(1, 16):
    for j in range(2, 10):
        if K == 0:
            break

        print((10 ** i) * j - 1)
        K -= 1
    if K == 0:
        break

Submission status: Wrong Answer

Solution code:



def s(t):
    su=0
    for j in range(len(str(t))):
        su+=int(str(t)[j])
    return su 
    


k=int(input())

for i in range(0,10):
    print(i+1)
    if i+1>=k:
        break

if k>10:

    le=10
    ri=22
    snri=s(21)
    snrip1=s(22)
    co=0

    while co<k-10 :

        while float(ri/snri)>float((ri+1)/snrip1):
            snri=snrip1
            snrip1=s(ri+1)
            ri+=1

        #print(str(le)+" "+str(ri))


        while float(le/s(le))>float(ri/snri):
            le+=1
        while float(le/s(le))<=float(ri/snri):
            print(str(le)+"\n")
            le+=1
            co+=1
            if co>=k-10 :
                break

        snri=snrip1
        snrip1=s(ri+1)
        ri+=1

Submission status: Wrong Answer

Solution code:



def s(t):
    su=0
    for j in range(len(str(t))):
        su+=int(str(t)[j])
    return su 
    


k=int(input())

for i in range(0,10):
    print(i+1)
    if i+1>=k:
        break

if k>10:

    le=10
    ri=22
    snri=s(21)
    snrip1=s(22)
    co=0

    while co<k-10 :

        while float(ri/snri)>float((ri+1)/snrip1):
            snri=snrip1
            snrip1=s(ri+1)
            ri+=1

        #print(str(le)+" "+str(ri))


        while float(le/s(le))>float(ri/snri):
            le+=1
        while float(le/s(le))<=float(ri/snri):
            print(le)
            le+=1
            co+=1
            if co>=k-10 :
                break

        snri=snrip1
        snrip1=s(ri+1)
        ri+=1

Submission status: Wrong Answer

Solution code:
K = int(input())

for i in range(1,K+1):
    i9 = i % 9
    i9keta = int((i-i9)/9)
    m = (i9+1)*(10**(i9keta))-1
    print(m)