您的位置:首页 > 其它

51nod 1010 只包含因子2 3 5的数

2016-11-03 19:57 190 查看
#include <bits/stdc++.h>
using namespace std;

long long limit=(long long)1<<60;
set<long long> st;
set<long long> ::iterator it;

int main()
{
long long T,n;
st.insert(2);
st.insert(3);
st.insert(5);
for(it=st.begin();*it<limit;it++)
{
st.insert((*it)*2);
st.insert((*it)*3);
st.insert((*it)*5);
}
cin>>T;
while(T--)
{
scanf("%lld",&n);
printf("%lld\n",*st.lower_bound(n));
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  51nod