The Super Powers UVA - 11752

  1. 使a为一个指数不为质数的数即可
  2. 枚举64以内的合数
  3. 枚举底为2-64的所有在范围内的指数,注意通过对数处理大小
#include<bits/stdc++.h>
using namespace std;
#define fst first
#define sec second
#define sci(num) scanf("%d",&num)
#define scl(num) scanf("%lld",&num)
#define mem(a,b) memset(a,b,sizeof a)
#define cpy(a,b) memcopy(a,b,sizeof b)
typedef long long LL;
typedef 
   
   
    
    unsigned
   
    long long ULL;
typedef pair<int,int> P;
const int MAX_N = 510;
const int MAX_M = 10000;
ULL nums[100];
int cnt;
set<ULL> ans;
void init() {
    cnt = 0;
    for (int i = 4;i <= 64;i++) {
        for (int j = 2;j * j <= i;j++) {
            if (i % j == 0) {
                nums[cnt++] = i;
                break;
            }
        }
    }
}
int main() {
    //freopen("1.txt","w",stdout);
    init();
    ans.clear();
    ans.insert(1);
    for (ULL i = 2;i < (1<<16);i++){
        int mp = ceil(64 * log(2) / log(i));
        ULL now = i * i * i * i;
        ans.insert(now);
        for (int j = 1;nums[j] < mp;j++) {
            now *= (nums[j] - nums[j - 1] == 1 ? i : i * i);
            ans.insert(now);
        }
    }
    //ans.
   
   
    
    erase
   
   (0);
    for (auto it : ans) {
        printf("%llu\n",it);
    }
    return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值