//2357数,当且仅当其所有大于1的因子均能被2/3/5/7中某个整除
//对于数字N,你需要求出不小于N的最小2357数
//2357数,当且仅当其所有大于1的因子均能被2/3/5/7中某个整除
//对于数字N,你需要求出不小于N的最小2357数
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;cin>>n; //输入N
priority_queue<int,vector<int>,greater<int> >pq;//小数优先
pq.push(2); //压入2
while(!pq.empty()){ //非空
int x=pq.top();pq.pop();//读出&弹出
if(x>=n){ //大于N符合条件
cout<<x<<endl; //输出
return 0; //结束
}
pq.push(x*2); //乘2压入
pq.push(x*3); //乘3压入
pq.push(x*5); //乘5压入
pq.push(x*7); //乘7压入
}
return 0;
}
/*
in
209
out
210
*/
/*
in
209
out
210
*/
05-20
1870
03-23
582
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交