题目链接

首先要知道一个性质, 一个数x的因子个数等于 a1^p1 * a2^p2*....an^pn, ai是x质因子, p是质因子的个数。

然后就可以搜了

#include <iostream>
#include <vector>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <stack>
#include <bitset>
using namespace std;
#define pb(x) push_back(x)
#define ll long long
#define mk(x, y) make_pair(x, y)
#define lson l, m, rt<<1
#define mem(a) memset(a, 0, sizeof(a))
#define rson m+1, r, rt<<1|1
#define mem1(a) memset(a, -1, sizeof(a))
#define mem2(a) memset(a, 0x3f, sizeof(a))
#define rep(i, n, a) for(int i = a; i<n; i++)
#define fi first
#define se second
typedef pair<int, int> pll;
const double PI = acos(-1.0);
const double eps = 1e-;
const int mod = 1e9+;
const int inf = ;
const int dir[][] = { {-, }, {, }, {, -}, {, } };
int n, f[], prime[], cnt;
ll ans = 1e18+;
void dfs(int pos, int num, ll val) {
if(pos>)
return ;
if(num>n)
return ;
if(num == n) {
ans = min(ans, val);
return ;
}
for(int i = ; i<=; i++) {
val *= prime[pos];
if(val>ans)
break;
dfs(pos+, num*(i+), val);
}
}
int main()
{
cin>>n;
for(int i = ; i<; i++) {
if(!f[i]) {
for(int j = i+i; j<; j+=i) {
f[j] = ;
}
prime[cnt++] = i;
}
}
dfs(, , );
cout<<ans<<endl;
return ;
}

codeforces 27E . Number With The Given Amount Of Divisors 搜索+数论的更多相关文章

  1. codeforces 27E Number With The Given Amount Of Divisors

    E. Number With The Given Amount Of Divisors time limit per test 2 seconds memory limit per test 256 ...

  2. Codeforces 27E. Number With The Given Amount Of Divisors (暴力)

    题目链接:http://codeforces.com/problemset/problem/27/E 暴力 //#pragma comment(linker, "/STACK:1024000 ...

  3. codeforces 27 E. Number With The Given Amount Of Divisors(数论+dfs)

    题目链接:http://codeforces.com/contest/27/problem/E 题意:问因数为n个的最小的数是多少. 题解:一般来说问到因数差不多都会想到素因子. 任意一个数x=(p1 ...

  4. Codeforces Beta Round #27 (Codeforces format, Div. 2) E. Number With The Given Amount Of Divisors 反素数

    E. Number With The Given Amount Of Divisors time limit per test 2 seconds memory limit per test 256 ...

  5. E. Number With The Given Amount Of Divisors

    E. Number With The Given Amount Of Divisors time limit per test 2 seconds memory limit per test 256 ...

  6. Codeforces Beta Round #27 E. Number With The Given Amount Of Divisors 含n个约数最小数

    http://codeforces.com/problemset/problem/27/E RT,求含n个约数的最小的数 我们设答案p = 2^t1 * 3^t2 * -- * p^tk(其中p是第k ...

  7. 大家一起做训练 第一场 E Number With The Given Amount Of Divisors

    题目来源:CodeForce #27 E 题目意思和题目标题一样,给一个n,求约数的个数恰好为n个的最小的数.保证答案在1018内. Orz,这题训练的时候没写出来. 这道题目分析一下,1018的不大 ...

  8. 【数学】【CF27E】 Number With The Given Amount Of Divisors

    传送门 Description 给定一个正整数\(n\),输出最小的整数,满足这个整数有n个因子 Input 一行一个整数\(n\) Output 一行一个整数,代表答案. Hint \(1~\leq ...

  9. 数论 CF27E Number With The Given Amount Of Divisors

    求因子数一定的最小数(反素数) #include<iostream> #include<string> #include<cmath> #include<cs ...

随机推荐

  1. Jquery Mobile 记录

    使用的是C#语言,.Net+Jquery Mobile 框架开发 1.使用水平组切换操作 <fieldset id="Tfdset1" data-role="con ...

  2. mac 桌面美化

    官网:Übersicht 先来大图:  当然,,,我自己的这个还不成型,去官网看看吧,有大神们做好的各种主题可选哦~ 像这样1: 这样2: 甚至这样3:(酷毙了有木有..)        Downlo ...

  3. 商品列表中显示类别名称而不是类别ID

    商品表中的字段包裹商品信息和categoryid 若要在商品列表中显示出categoryname,有两种做法: 第一种做法: 拿到categoryid后再跟数据库连接一下,然后拿出categoryna ...

  4. Git 操作常用命令

    Git使用 1. git pull    更新服务器代码到本地a). git pull origin master是将origin这个版本库的代码更新到本地的master主分支 2. git push ...

  5. aix archPlat

    #++++++++++++++++++++++++++++++++++++++++++++++++++++ #+ Ruiy(R) Techdiss contact: 150 5519 8367 #+ ...

  6. paip.QQ音乐导出歌单总结

    paip.QQ音乐导出歌单总结 作者Attilax ,  EMAIL:1466519819@qq.com  来源:attilax的专栏 地址:http://blog.csdn.net/attilax ...

  7. iOS 开发的几种手势

    今天为大家介绍一下IOS 的七种手势,手势在开发中经常用到,所以就简单 通俗易懂的说下, 话不多说,直接看代码: // 初始化一个UIimageView UIImageView *imageView ...

  8. Redis的同步(主从复制)和Redis Sentinel

    Redis的同步可以让其他服务器拥有一个不断更新的数据副本,从而使拥有数据副本的服务器可以处理客户端发出的读请求. 1.Redis同步的方法: 我们可以通过发送SLAVEOF host port命令来 ...

  9. http multipart/form-data POST文件上传详解

    POST /test/index.php HTTP/1.1 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:26.0) Gecko/20100101 Firef ...

  10. SQL Server DBA三十问【转】

    http://database.51cto.com/art/201110/298926.htm 很多开发人员都想成为一名DBA,也有很多人一开始就把自己定位成为一名DBA,DBA究竟需要掌握些什么知识 ...