Solution to Ugly Number from Jobdu

31 Aug

Question (in Chinese):

Question Name: Ugly Number

Question Description: Ugly numbers are the integers, whose prime factors could only be 2, 3, and/or 5. Typically 1 is also considered as an ugly number. We need to find the i(th) smallest ugly number.

Input: the input might contain multiple test cases. Each test case contains one line, which includes only one integer, to say i.

Output: For each test case, print the i(th) smallest ugly number.

The solution is:

Leave a Reply

Your email address will not be published. Required fields are marked *