题解

1 条题解

  • 0
    @ 2017-11-08 16:58:29
    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <iostream>
    using namespace std;
    long long n, maxd, ans;
    int prime[] = {0, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41};
    void dfs(int x, long long sum, long long nowd, long long Limit) {
        if (nowd > maxd || (nowd == maxd && sum < ans))
            maxd = nowd, ans = sum;
        if (x > 11) return;
        for (int i = 1; sum * prime[x] <= n && i <= Limit; i++)
            dfs(x + 1, sum *= prime[x], nowd * (i + 1), i);
    }
    int main()
    {
        //freopen("divisors.in","r",stdin);
        //freopen("divisors.out","w",stdout);
        cin >> n;
        ans = 1;
        if (n > 1) dfs(1, 1, 1, 1e9);
        cout << ans << endl;
        return 0;  
    }
    
  • 1

信息

难度
9
分类
(无)
标签
(无)
递交数
1
已通过
1
通过率
100%
上传者