#include<iostream>
#include<queue>
#include<set>
#define ll long long
using namespace std;
priority_queue<ll,vector<ll>,greater<ll> > Q;
set<ll> st;
int d[]={2,3,5};
int main(){
int k=0;
Q.push(1);
while(1)
{
k++;
ll x=Q.top();
Q.pop();
if(k==1500)
{
cout<<x<<endl;
break;
}
for(int i=0;i<3;++i)
{
ll y=x*d[i];
if(st.count(y)==0)
{
st.insert(y);
Q.push(y);
}
}
}
return 0;
}
丑数(递推||优先队列)
最新推荐文章于 2023-02-25 22:41:55 发布