很明显可以转化为反素数的题目。由于有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. linux for LVM 创建笔记

    LVM: 1.创建pv(物理卷) [root@localhost dev]# pvcreate /dev/sdd /dev/sde /dev/sdf Writing physical volume d ...

  2. php和nodejs

    整个故事正如好莱坞大片的经典剧情走向:两位昔日好友如今分道扬镳,甚至被迫陷入了你死我活的斗争当中.刚开始的分歧并不严重,无非是一位老友对于另一位伙伴长久以来占据.但又绝口不提的业务领域产生了点兴趣.而 ...

  3. 转载【梦想天空(山边小溪)】Web 开发人员和设计师必读文章推荐【系列二十九】

    博客地址:http://www.cnblogs.com/lhb25/p/must-read-links-for-web-designers-and-developers-volume-29.html

  4. MSDN性能分析相关网站收集

    Visual Studio 性能分析初学者指南 | Microsoft Docshttps://docs.microsoft.com/zh-cn/visualstudio/profiling/begi ...

  5. 腾讯新闻多图jQuery相册展示效果代码

    腾讯新闻多图jQuery相册代码,带左右切换箭头,带缩略图,可左右切换,点击缩略图展示原图. 在线演示本地下载

  6. Cocos2d-x-3.6学习笔记第一天

    系统环境: win7,python2.7 开发工具:vs2013 cocos版本:cocos2d-x-3.6 暂无模拟手机的环境 新建我的第一个cocos2d项目 1.打开cmd,cd到cocos2d ...

  7. 配置postgreSQL允许外部连接

    配置远 程连接PostgreSQL数据库的步骤很简单,只需要修改 %PostgreSQL_path%/data 目录下的 pg_hba.conf 和 postgresql.conf. 一.修改pg_h ...

  8. 1 ERP管理系统概念

    1 ERP管理系统概念 一.ERP是什么? ERP是企业资源计划(Enterpise Resource Planning)的简称,蕴含现代企业管理理念,其核心是在制造资源计划基础上进一步发展而成的面向 ...

  9. What's Dead & Exploded in Swift's exception stack?

    The Swift compiler marks function arguments for a number of reasons, mostly related to internal opti ...

  10. PhotoZoom放大图片,真的能无损吗?

    当然想要无损放大一张很小的图片时,总会有人会和你推荐PhotoZoom这款软件,那么它真的和说的一样,可以无损放大吗?下面小编挑了2张图片做了一下对比. 案例1,我们选取一张尺寸为200x200像素的 ...