题目大意:一种数=2^a*3^b*5^c*7^d,给你一个数n让你找出第一个不小于n的满足上式的数
思路:打表+二分
ac代码:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <algorithm>
using namespace std;
long long a[200000];
int main()
{
int x,y;
int d=0;
memset(a,0,sizeof(a));
for(int i=0;i<=32;i++)
{
for(int j=0;j<=19;j++)
{
for(int k=0;k<=12;k++)
{
for(int h=0;h<=11;h++)
{
long long s=pow(2,i)*pow(3,j)*pow(5,k)*pow(7,h);
if(s>1000000000||s<0)
break;
else
{a[d++]=s;
}
}
}
}
}
sort(a,
scanf("%d",&x);
while(x--)
{
scanf("%d",&y);
printf("%lld\n",*lower_bound(a,a+d,y));
}
return 0;
}