class Solution {
public:
int getUglyNumber(int n) {
if(n <= 1) return n;
vector<int> f(1,1);
int i = 0,j = 0,k = 0;
long long t = 0;
while(--n){ //循环n-1次,n--为循环n次
t = min(f[i] * 2,min(f[j] * 3,f[k] * 5));
if(t == f[i] * 2) i++;
if(t == f[j] * 3) j++;
if(t == f[k] * 5) k++;
f.push_back(t);
}
return f.back(); //返回f的最后一个元素
}
};