zoukankan      html  css  js  c++  java
  • CF27E Number With The Given Amount Of Divisors

    显然质数越小越好,越小的质数次方越大越好,写个dfs爆搜一下

    #include<bits/stdc++.h>
    using namespace std;
    typedef unsigned long long ll;
    const int N=4e5+10;
    const int inf=0x3f3f3f3f;
    int n;
    ll ans=1000000000000000001;
    int prime[]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53};
    void dfs(ll now,int cur,int p,int cnt) {
        if(cnt>n) return;
        if(now>ans) return;
        if(cur>15) return;
        if(cnt==n){
            ans=now;return;
        }
        for(int i=1;i<=p;++i) {
            dfs(now*=prime[cur],cur+1,i,cnt*(i+1));
        }
    }
    int main(){
        ios::sync_with_stdio(false);
        cin>>n;
        dfs(1ll,0,64,1);
        cout<<ans<<endl;
    }
    View Code
    没有人不辛苦,只有人不喊疼
  • 相关阅读:
    【Coreforces 1253E】
    计数专题乱做
    PKUWC2020乱做
    多项式板子
    notepad
    2021.4.9
    2021.4.8
    2021.3.31
    2021.3.26
    2021.3.25
  • 原文地址:https://www.cnblogs.com/ctyakwf/p/13786132.html
Copyright © 2011-2022 走看看