E. Number With The Given Amount Of Divisors
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Given the number n, find the smallest positive integer which has exactly n divisors. It is guaranteed that for the given n the answer will not exceed 1018.

Input

The first line of the input contains integer n (1 ≤ n ≤ 1000).

Output

Output the smallest positive integer with exactly n divisors.

Examples
input
4
output
6
input
6
output
12

思路:反素数;

(1)一个反素数的所有质因子必然是从2开始的连续若干个质数,因为反素数是保证约数个数为的这个数尽量小

(2)同样的道理,如果,那么必有

 1 #include<stdio.h>
2 #include<algorithm>
3 #include<iostream>
4 #include<string.h>
5 #include<queue>
6 #include<math.h>
7 #include<set>
8 #include<vector>
9 #include<string.h>
10 using namespace std;
11 typedef long long LL;
12 bool prime[100];
13 int ans[100];
14 LL minn = 1e18+10;
15 LL maxx = 1e18;
16 void dfs(LL n,int cn,int pre,int need,int cnt);
17 int main(void)
18 {
19 LL m,n;
20 int i,j;
21 int cn = 0;
22 memset(prime,0,sizeof(prime));
23 for(i = 2 ; i < 100 ; i++)
24 {
25 if(!prime[i])
26 {
27 ans[cn++] = i;
28 for(j = i; (i*j) <= 100 ; j++)
29 {
30 prime[i*j]=true;
31 }
32 }
33 }
34 int ak = 16;
35 while(scanf("%lld",&n)!=EOF)
36 {
37 minn = 1e18+10;
38 dfs(1,0,63,n,1);
39 printf("%lld\n",minn);
40 }
41 return 0;
42 }
43 void dfs(LL n,int cn,int pre,int need,int cnt)
44 {
45 if(cnt>need)return ;
46 if(cnt == need)
47 {
48 minn = min(minn,n);
49 return ;
50 }
51 LL ap = 1;
52 int i,j;
53 for(i = 1; i <= pre; i++)
54 { if(maxx/ap>=ans[cn])
55 ap*=ans[cn];
56 else return ;
57 if(maxx/n >= ap)dfs(n*ap,cn+1,pre,need,cnt*(1+i));
58 else return ;
59
60 }
61 }

最新文章

  1. 在Linux上编译dotnet cli的源代码生成.NET Core SDK的安装包
  2. HTML5 随机弹跳的小球
  3. LaTex Remove Left Margin 去除左边空间
  4. 1121 if条件语句练习--输入年月日判断执行
  5. Yii 框架创建自己的 web 应用
  6. unique() 去重函数
  7. auto_ptr解析
  8. MVC 的HTTP请求
  9. CSS clip:rect矩形剪裁功能及一些应用介绍
  10. hdoj 1242 Rescue
  11. SQLServer 工具技巧
  12. jquery 组合键键盘事件
  13. Mego开发文档 - 数据属性生成值
  14. Evensgn 捡树枝
  15. C语言的整型溢出问题 int、long、long long取值范围 最大最小值
  16. 杂记-python
  17. struts2框架学习之第一天
  18. C数据结构 : 线性表 与 链表
  19. .net中反射与IOC容器实现
  20. 将句子表示为向量(上):无监督句子表示学习(sentence embedding)

热门文章

  1. 3 - 简单了解一下springboot中的yml语法 和 使用yml赋值
  2. 巩固javaweb的第三十天
  3. JDBC01 获取数据库连接
  4. apostrophe
  5. A Child&#39;s History of England.39
  6. 【MarkDown】--使用教程
  7. Linux的小知识
  8. oracle中的数组
  9. 机器学习常用python包
  10. docker安装jumpserver