CodeForces 27 E.Number With The Given Amount Of Divisors(dfs)
来源:互联网 发布:淘宝怎么修改好评评价 编辑:程序博客网 时间:2024/06/12 21:34
Description
给出一整数
Input
一个正整数
Output
输出有
Sample Input
4
Sample Output
6
Solution
答案不超过
Code
#include<cstdio>#include<iostream>#include<cstring>#include<algorithm>#include<cmath>#include<vector>#include<queue>#include<map>#include<set>#include<ctime>using namespace std;typedef long long ll;typedef pair<int,int>P;const int INF=0x3f3f3f3f,maxn=101;int n,p[]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};ll ans;void dfs(int pos,int tn,ll tans){ if(n==tn) { ans=min(ans,tans); return ; } for(int i=1;i<=60;i++) { if(tn*(i+1)>n||tans*p[pos]>ans)break; tans*=p[pos]; dfs(pos+1,tn*(i+1),tans); }}int main(){ while(~scanf("%d",&n)) { ans=1e18; dfs(0,1,1); printf("%I64d\n",ans); } return 0;}
阅读全文
0 0
- 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)
- 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
- CF-27E - Number With The Given Amount Of Divisors(枚举+dfs)
- CodeForces - 27E Number With The Given Amount Of Divisors (反素数入门)
- [CodeForces 27E] Number With The Given Amount Of Divisors (数论 + 反素数)
- CF 27E Number With The Given Amount Of Divisors
- 27E - Number With The Given Amount Of Divisors
- codeforces 27E E. Number With The Given Amount Of Divisors(dp+数论)
- day4 CodeForces 27E Number With The Given Amount Of Divisors
- Codeforces Beta Round #27-E. 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(反素数)
- WebService的整理:
- zookeeper-简介(二)
- Web服务器和客户端
- static用法
- Binder服务使用过程
- CodeForces 27 E.Number With The Given Amount Of Divisors(dfs)
- HTML中      等6种空白空格的区别
- 浅谈clearfix类和clear清除浮动
- 单变量分析绘制-学习笔记
- Docker01_基础环境搭建
- MySQL绿色版安装指南
- linux 6.5 杂集
- 小白解决CENTOS7错误:Cannot find a valid baseurl for repo: base/7/x86_6
- (string)、toString()和String.valueOf()三种类型转换