CodeForces - 27E Number With The Given Amount Of Divisors (反素数入门)
来源:互联网 发布:知可之伯母邪恶漫画 编辑:程序博客网 时间:2024/06/13 02:17
CodeForces - 27E
Number With The Given Amount Of Divisors
Description
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.
Sample Input
Input
4
Output
6
Input
6
Output
12
#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;typedef unsigned long long ll;const ll INF = (ll)1<<63;int n;ll ans;int p[16]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53};void dfs(int gen,ll tmp,int num){if(num>n)return ;if(num==n&&ans>tmp)ans=tmp;for(int i=1;i<=63;i++){if(ans/p[gen]<tmp)break;dfs(gen+1,tmp*=p[gen],num*(i+1));}}int main(){while(scanf("%d",&n)!=EOF){ans=INF;dfs(0,1,1);printf("%lld\n",ans);}return 0;}
0 0
- CodeForces - 27E Number With The Given Amount Of Divisors (反素数入门)
- [CodeForces 27E] Number With The Given Amount Of Divisors (数论 + 反素数)
- CodeForces 27E Number With The Given Amount Of Divisors【反素数】
- codeforces 27 E. Number With The Given Amount Of Divisors(反素数)
- codeforces 27E Number With The Given Amount Of Divisors(反素数)
- Codeforces 27E - Number With The Given Amount Of Divisors
- Codeforces 27E Number With The Given Amount Of Divisors
- Codeforces 27 E Number With The Given Amount Of Divisors
- CodeForces 27E Number With The Given Amount Of Divisors
- codeforces 27E Number With The Given Amount Of Divisors
- Codeforeces 27 E Number With The Given Amount Of Divisors(反素数)
- CodeForce 27E: Number With The Given Amount Of Divisors(求反素数)
- zoj2562 More Divisors && CF27E. Number With The Given Amount Of Divisors(反素数)
- codeforces 27E - Number With The Given Amount Of Divisors (数论 dfs)
- CodeForces - 27E Number With The Given Amount Of Divisors (DFS+数学)
- CodeForces 27 E.Number With The Given Amount Of Divisors(dfs)
- CF 27E Number With The Given Amount Of Divisors
- 27E - Number With The Given Amount Of Divisors
- javaday03-语言基础
- LeetCode(217)Contains Duplicate
- jsp技术
- 五大常用算法之二:动态规划算法
- 对【委托的执行方法】的测试与理解
- CodeForces - 27E Number With The Given Amount Of Divisors (反素数入门)
- ubuntu下Qt cannot find -lGL错误的解决方法
- java中的格式输出
- ScheduledExecutorService定时周期执行指定的任务
- kafka+zookeeper环境配置(Mac 或者 linux环境)
- 【算法训练】八皇后问题回溯算法求解
- sql 根据经纬度求距离
- Android startActivityForResult(intent, requestCode)的用法。
- C、c++ .h 头文件的作用