题目:
定义如下函数:

 pow(a,b)=ab

 F(x)=min{Z|Z的因子数为pow(2,x)}

求F(x),答案对2334335669取模
思路:
数学题 GDUT 院赛(数论)数学题 GDUT 院赛(数论)

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod = 2334335669ll;
const int N = 100005;
bool use[N];
ll ans[5005];
//判断x是否为质数
bool check(int x){
    for(int i = 2; i*i <= x; i ++)
        if(x%i == 0)return false;
    return true;
}
//预处理答案
void prework(){
    for(int i = 2; i < N; i ++){
        if(use[i] || !check(i))continue;
        for(ll tmp = i; tmp < N; tmp = tmp*tmp)
            use[tmp] = 1;
    }
    int cnt = 0;
    ans[cnt] = 1, cnt ++;
    for(int i = 2; i < N && cnt < 5005; i ++){
        if(use[i]){
            ans[cnt] = (ans[cnt - 1]*i)%mod;
            cnt ++;
        }
    }
}
int T, x;
int main(){
    prework();
    scanf("%d", &T);
    while(T--){
        scanf("%d", &x);
        printf("%lld\n", ans[x]);
    }
    return 0;
}

相关文章:

  • 2022-12-23
  • 2021-12-14
  • 2022-12-23
  • 2021-05-30
  • 2022-12-23
  • 2022-12-23
  • 2021-06-02
  • 2021-11-30
猜你喜欢
  • 2021-09-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-25
  • 2022-12-23
  • 2021-06-11
相关资源
相似解决方案