标签:动态规划

[ACM_ZJUT_1089]Ugly Numbers

蓝飞 蓝飞 | 时间:2012-03-28, Wed | 7,740 views
编程算法 

Ugly Numbers

Time Limit:1000MS  Memory Limit:32768K

Description

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, 15, ... shows the first 11 ugly numbers. By convention, 1 is included. Write a program to find and print the n’th ugly number.

Input

Every integer number (≤1500)describing position of ugly number from 1.If integer number is 0,the process should ended. Maybe there are 10000 integer numbers on input data.

Output

Every integer given should output a line as shown below, The <n>th ugly number is <number>. with <n> replaced by the integer number and <number> replaced by the number computed.

(阅读全文…)