反素数ant BZOJ - 1053

题目传送门

思路:这个题本来应该是一个用上唯一分解定理的爆搜,但是我没有想到一个好的放大就直接打了一个表来做的(以后补上爆搜的方法)。

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define MAXN 50010
#define MAXE 5
#define INF 1000000000
#define MOD 1000000007
#define LL long long
#define ULL unsigned long long
#define pi 3.14159

using namespace std;

LL num[] = {1, 2, 4, 6, 12, 24, 36, 48, 60, 120, 180, 240, 360, 720, 840, 1260, 1680, 2520, 5040, 7560, 10080, 15120, 20160, 25200, 27720, 45360, 50400, 55440, 83160, 110880, 166320, 221760, 277200, 332640, 498960, 554400, 665280, 720720, 1081080, 1441440, 2162160, 2882880, 3603600, 4324320, 6486480, 7207200, 8648640, 10810800, 14414400, 17297280, 21621600, 32432400, 36756720, 43243200, 61261200, 73513440, 110270160, 122522400, 147026880, 183783600, 245044800, 294053760, 367567200, 551350800, 698377680, 735134400, 1102701600,
    1396755360, 3000000000};

int main() {
    std::ios::sync_with_stdio(false);
    LL n;
    cin >> n;
    int cnt = 0;
    while (num[cnt] <= n) {
        cnt++;
    }
    cout << num[cnt - 1] << endl;
    return 0;
}

/*
 2
 4
 6
 12
 24
 36
 48
 60
 120
 180
 240
 360
 720
 840
 1260
 1680
 2520
 5040
 7560
 10080
 15120
 20160
 25200
 27720
 45360
 50400
 55440
 83160
 110880
 166320
 221760
 277200
 332640
 498960
 554400
 665280
 720720
 1081080
 1441440
 2162160
 2882880
 3603600
 4324320
 6486480
 7207200
 8648640
 10810800
 14414400
 17297280
 21621600
 32432400
 36756720
 43243200
 61261200
 73513440
 110270160
 122522400
 147026880
 183783600
 245044800
 294053760
 367567200
 551350800
 698377680
 735134400
 1102701600
 1396755360
 */
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值