• 1986 Ugly Numbers

    时间限制 : 2000/1000 MS(Java/Others) | 内存限制 : 131072/65536 KB(Java/Others)

    提交数 : 28 | 通过数 : 10

    题目描述

    Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence 
    1, 2, 3, 4, 5, 6, 8, 9, 10, 12, ... 
    shows the first 10 ugly numbers. By convention, 1 is included. 
    Given the integer n,write a program to find and print the n'th ugly number

    输入要求

    Each line of the input contains a postisive integer n (n <= 1500).Input is terminated by a line with n=0.

    输出要求

    For each line, output the n’th ugly number .:Don’t deal with the line with n=0.

    输入样例

    1
    2
    9
    0
    

    输出样例

    1
    2
    10
    
    

    提示


    来源

    New Zealand 1990 Division I,UVA 136

    [ 返回顶端 ] | [ 代码提交 ] | [ 统计数据 ] | [ 历史提交 ]