문제2459--Ugly Numbers

2459: Ugly Numbers

실행시간 제한: 1 Sec  메모리사용 제한: 64 MB
제출: 1  통과: 1
[제출] [채점기록] [묻고답하기]

문제 설명

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.

입력 예시 Copy

1
2
9
0

출력 예시 Copy

1
2
10

출처/분류