153. N-th Ugly Number
MediumDynamic Programming
Ugly numbers have no prime factors other than 2, 3 and 5 (1 is ugly). Print the n-th ugly number.
Input format
A single integer n.
Output format
The n-th ugly number.
Example 1
Input
10
Output
12
Example 2
Input
1
Output
1
Constraints
1 ≤ n ≤ 1690
Read input from standard input and print the answer to standard output. Your code is judged against 4 test cases, most of them hidden.
Loading the MyLoginn IDE…