从网上找的一种思路,,打表的方法很棒
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
#define N 200000
long long int a[N];
void get(){
int i,x,y,z;
x=y=z=0;
a[0]=1;
for(i=1;i<=21610;i++){
a[i]=min(2*a[x],min(3*a[y],5*a[z]));
if(a[i]==2*a[x]) x++;
if(a[i]==3*a[y]) y++;
if(a[i]==5*a[z]) z++;
}
return ;
}