题目链接

首先要知道一个性质, 一个数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. 二、fragment使用

    转载请注明出处:http://blog.csdn.net/guolin_blog/article/details/8881711 我们都知道,Android上的界面展示都是通过Activity实现的, ...

  2. log4net简单用法

    一.NuGet在Server,mvc中添加Common.Logging和common.Logging.Log4Net如下图 二.在Server层创建logger类 <?xml version=& ...

  3. How to Install/Deinstall Oracle Workspace Manager (文档 ID 263428.1)

    In this Document   Goal   Solution   References APPLIES TO: Workspace Manager - Version 9.0.1.0 to 1 ...

  4. WebStorm11 注册码

    这个注册方法我也是在贴吧上看到的:http://tieba.baidu.com/p/4160766032 注册方法 注册时选择“License server”输入“http://15.idea.lan ...

  5. matplotlib中使用imshow绘制二维图

    #coding:utf-8 from matplotlib import mpl import matplotlib.pyplot as plt#载入matplotlib快速绘图的函数库 import ...

  6. python3.5之string

    刚开始学习python变成, 这勉强算是第一个博客吧, 主要记录了一下 字符串 中的方法, 不太准确,或者是错误的地方, 请大家指点 str1 = "GooGle" str2 = ...

  7. Linux 下搭建ftp服务器 指定用户指定目录及其他操作

    搭建 Linux下 rpm -qa |grep vsftpd查看是否安装 没安装yum安装 /etc/vsftpd/目录下有vsftpd.conf配置文件 根据需求 进行配置  是否使用匿名用户以及文 ...

  8. Linux内核之进程和文件共享

    1.Shell命令的执行和进程    Shell 命令可以是内部或者外部命令.    内部(内置)命令(internal (built-in) command)的代码本身就是shell进程的一部分.L ...

  9. linux系统下安全管理

    1.引导程序安全 linux系统的root密码是很容易破解的,当然前提是你没有设置引导程序密码,如GRUB或LILO,为了防止通过引导程序破译root密码,强烈建 议设置GRUB或LILO的引导密码, ...

  10. Gentoo Linux 学习笔记1

         Gentoo Linux是一个基于portage进行包管理的Linux发行版,最早版本始于2002年.其官方官网为http://www.gentoo.org 目前,Gentoo Linux已 ...