zoukankan      html  css  js  c++  java
  • 【BZOJ1503】[HAOI2007]反素数ant 搜索

    结论题。。。网上讲的好的很多。。。

     1 #include <iostream>
     2 using namespace std;
     3 int p[11]={2,3,5,7,11,13,17,19,23,29},num=0;
     4 long long ans,n;
     5 void dfs(int x,int y,long long z)
     6 {
     7     if (y>num) {num=y; ans=2100000000;}
     8     if (y==num) ans=min(ans,z);
     9     if (x>=10) return;
    10     for (int i=0;z<=n;z*=p[x],++i) dfs(x+1,y*(i+1),z);
    11 }
    12 int main()
    13 {
    14     cin>>n;
    15     dfs(0,1,1);
    16     cout<<ans;
    17     return 0;
    18 }
    View Code

    Description

    对于任何正整数x,其约数的个数记作g(x)。例如g(1)=1、g(6)=4。
    如果某个正整数x满足:g(x)>g(i) 0<i<x,则称x为反质数。例如,整数1,2,4,6等都是反质数。
    现在给定一个数N,你能求出不超过N的最大的反质数么?

    Input

    一个数N(1<=N<=2,000,000,000)。

    Output

    不超过N的最大的反质数。

    Sample Input

    1000

    Sample Output

    840

    HINT

     

    Source

    —Anime Otaku Save The World.
  • 相关阅读:
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    codevs 2977 二叉堆练习1x
    codevs 2010 求后序遍历x
    二叉树的序遍历x(内含结构体与非结构体版x)
    医院设置x
    求后序遍历x
    [LightOJ1017]Brush (III)(dp)
  • 原文地址:https://www.cnblogs.com/DMoon/p/5324873.html
Copyright © 2011-2022 走看看