2573Ugly numbers

2573   Ugly numbers

题目描述

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.

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

说明

69
338
通过提交
时空限制1000ms/128mb
题目来源
评测方式在线评测
题目类型
难        度