diff --git a/HDOJ/5878_chouti.cpp b/HDOJ/5878_chouti.cpp new file mode 100644 index 0000000..a50bd98 --- /dev/null +++ b/HDOJ/5878_chouti.cpp @@ -0,0 +1,48 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +using namespace std; +#define inf 1001001001 +#define infll 1001001001001001001LL +#define ll long long +#define dbg(vari) cerr<<#vari<<" = "<<(vari)< +il int read(){ + bool f=true;Ri x=0;char ch;while(!isdigit(ch=gc))if(ch=='-')f=false;while(isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=gc;}return f?x:-x; +} +#define gi read() +ll p[10000],_p; +setq; +int main(){ + q.insert(1); + int cnt=0; + while(!q.empty()){ + p[++_p]=*q.begin(); + q.erase(p[_p]); + ll t=p[_p]; + if(t>1000000000){break;} + if(2*t<=1000000000)q.insert(2*t); + if(3*t<=1000000000)q.insert(5*t); + if(5*t<=1000000000)q.insert(3*t); + if(7*t<=1000000000)q.insert(7*t); + } + int T=gi; + while(T--){ + int n=gi; + int pos = lower_bound(p+1, p+_p+1, n) - p; + printf("%I64d\n", p[pos]); + } +}