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

Solution in C# (Mono 4.6.2.0) (judge verdict: Wrong Answer)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Practice
{
    class Program
    {

        static void Main(string[] args)
        {
            //SolveA(args);
            //SolveB(args);
            //SolveC(args);
            SolveD(args);
        }


        static void SolveA(string[] args)
        {
            string sz = (Console.ReadLine());
            int num = 0;
            for(int i=0;i<sz.Length;++i)
            {
                char c = sz[i];
                if( c == '+')
                {
                    num++;
                }else
                {
                    num--;
                }
            }
            Console.WriteLine(num);
        }
        static void SolveB(string[] args)
        {
            string sz = Console.ReadLine();
            long n = long.Parse(sz);
            int sn = 0;
            for (int i = 0; i < sz.Length; ++i)
            {
                int tmp = int.Parse(sz[i].ToString());
                sn += tmp;
            }
            if( n % sn == 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
        static void SolveC(string[] args)
        {
            string[] szArr = Console.ReadLine().Split(' ');
            int n = int.Parse(szArr[0]);
            int k = int.Parse(szArr[1]);
            szArr = Console.ReadLine().Split(' ');
            int[] a = new int[szArr.Length];

            for (int i = 0; i < szArr.Length; ++i)
            {
                a[i] = int.Parse(szArr[i]);
            }
            int min = 1;

            if (n == k)
            {
                min = 1;
            }
            else
            {
                min = (int)Math.Ceiling((double)(n - 1) / (k-1));
            }
            Console.WriteLine(min);
            
        }

        static void SolveD(string[] args)
        {
            long k = long.Parse(Console.ReadLine());

            
            
            
            long n = 1;
            long sunukeTotal = 0;
            long prevSunuke = 0;
            // とりあえず1~9は確定
            while (sunukeTotal < k && n <= 9)
            {
                sunukeTotal++;
                prevSunuke = n;
                Console.WriteLine(n);
                n++;
            }

            while(sunukeTotal < k)
            {

                long fn = Func(n);
                Console.WriteLine(fn);
                n = fn;
                sunukeTotal++;
            }



        }
        /// <summary>
        /// n以上の整数mであってm/S(m)を最小にするもの（複数ある場合は、そのうちmが最小になるもの
        /// </summary>
        /// <param name="n"></param>
        /// <returns></returns>
        private static long Func(long n)
        {
            long fn = long.MaxValue;
            double minVal = double.MaxValue;
            int d = (int)Math.Log10(n) + 1;// todo 精度大丈夫？
            for (int di = 0; di <= d; ++di)
            {
                long tmp = (long)Math.Pow(10, di + 1);
                long x = tmp * (long)Math.Floor((double)n / tmp + 1) - 1;
                double val = (double)x / Sum(x);
                if (val < minVal)
                {
                    minVal = val;
                    fn = x;
                }
            }
            return fn;
        }

        private static long Sum(long x)
        {
            long sum = 0;
            while( x > 0)
            {
                sum += x % 10;
                x /= 10;
            }
            return sum;
        }
    }

}