I Count Tow Three


#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
const int INF = 1000000000;
const int maxn = 100005;

int main()
{
    int T;
    int n;
    int  d = 0;
    ll a[maxn];
    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 l = 0; l <= 11; l++)
    {
        ll s = pow(2,i)*pow(3,j)*pow(5,k)*pow(7,l);
        if(s > 0 && s < 1e9+7)
            a[d++] = s;
        else break;
    }
    sort(a, a+d);
    cin >> T;
    while(T--)
    {

    scanf("%d",&n); // 大量输入, 不能用cin
    //  int x= *lower_bound(a,a+d,n); // lower_bound 要用引用;
    printf("%lld\n",*lower_bound(a,a+d,n));
  //  printf("%lld\n", x);

    }

    return 0;
}


猜你喜欢

转载自www.cnblogs.com/mrh-acmer/p/9404549.html
今日推荐