很明显可以转化为反素数的题目。由于有n种不同的方式,所以,数的约数可以为2*n或者2*n-1

#include <iostream>
#include <cstdio>
#include <cstring>
#define LL __int64 using namespace std; LL p[16]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53};
LL n,k; void dfs(LL dep,LL tmp,LL num, LL &ans){
if(num>k) return;
if(num==k){
if(tmp<ans)
ans=tmp;
return ;
}
for(LL i=1;i<=60;i++){
if(tmp*p[dep]>ans) break;
tmp*=p[dep];
dfs(dep+1,tmp,num*(i+1),ans);
}
} int main(){
while(scanf("%I64d",&n),n){
k=2*n;
LL ansi=(1LL<<60);
// cout<<ansi<<endl;
dfs(0,1,1,ansi);
// cout<<ansi<<endl;
k=2*n-1;
LL ansj=(1LL<<60);
dfs(0,1,1,ansj);
// cout<<ansj<<endl;
printf("%I64d\n",ansi<ansj?ansi:ansj);
}
return 0;
}

  

HDU 4228的更多相关文章

  1. ZOJ 2562 HDU 4228 反素数

    反素数: 对于不论什么正整数x,起约数的个数记做g(x).比如g(1)=1,g(6)=4. 假设某个正整数x满足:对于随意i(0<i<x),都有g(i)<g(x),则称x为反素数. ...

  2. HDU 4228 Flooring Tiles 反素数

    推出了结论,万万没想到最后用搜索.. 还想dp来着.. #include <cstdio> #include <cstring> #include <iostream&g ...

  3. HDU 5643 King's Game 打表

    King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember hi ...

  4. HDOJ 2111. Saving HDU 贪心 结构体排序

    Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  5. 【HDU 3037】Saving Beans Lucas定理模板

    http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...

  6. hdu 4859 海岸线 Bestcoder Round 1

    http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...

  7. HDU 4569 Special equations(取模)

    Special equations Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

  8. HDU 4006The kth great number(K大数 +小顶堆)

    The kth great number Time Limit:1000MS     Memory Limit:65768KB     64bit IO Format:%I64d & %I64 ...

  9. HDU 1796How many integers can you find(容斥原理)

    How many integers can you find Time Limit:5000MS     Memory Limit:32768KB     64bit IO Format:%I64d ...

随机推荐

  1. poj 2135 Farm Tour 【无向图最小费用最大流】

    题目:id=2135" target="_blank">poj 2135 Farm Tour 题意:给出一个无向图,问从 1 点到 n 点然后又回到一点总共的最短路 ...

  2. SQLServer2012 表IAM存储结构探究

    SQLServer2012 表IAM存储结构探究 Author:zfive5(zidong) Email: zfive5@163.com 引子 国庆节期间,一直在翻阅<程序猿的自我修养-链接.装 ...

  3. 0x55 环形与后效性问题

    poj2228 分第一天是否熟睡DP两次 #include<cstdio> #include<iostream> #include<cstring> #includ ...

  4. CodeForces 651A(水题)

    Friends are going to play console. They have two joysticks and only one charger for them. Initially ...

  5. java中 抽象类和抽象方法

    在面向对象中,所有的对象都是由类来描绘的,但是并不是所有的类都用来描绘对象的,当一个类并不能包含完整的信息来描绘一个具体的对象时,我们把这个类称为抽象类.抽象类除了不完整的描述一个对象之外,其他的功能 ...

  6. HTTP请求与请求头

    HTTP 的请求报文分为三个部分 请求行.请求头和请求体,格式如图:一个典型的请求消息头域,如下所示: POST/GET http://download.microtool.de:80/somedat ...

  7. Ubuntu16.04下将hadoop2.7.3源代码导入到eclipse neon中

    0.为什么会有这篇: 这篇文章的目的在于帮助想学习hadoop源码的内容,却在导入的过程中出现了各种问题的人. 或许你一定找了很多博客都无果,那么不用担心,我和你一样,这也是这篇文章存在的意义,废话少 ...

  8. TexturePacker贴图打包工具

    1.该软件是收费的,不过对于这么一款实用的工具来说,物有所值,下载地址 http://www.codeandweb.com/texturepacker 2.openGL载入纹理图片的时候,所用内存是会 ...

  9. html/css常用合集

    1. 消除inline-block元素间的换行间隙问题: {font-size:0;} 兼容IE6/7浏览器的方法:letter-spacing属性.   2.让两个inline-block的div顶 ...

  10. NOIP 2012 D1T1 Vigenère密码

    嗯嗯 一道找规律的题.... 真佩服那些把表打出来的人 //By SiriusRen #include <cstdio> #include <cstring> using na ...