题目链接:http://codeforces.com/problemset/problem/27/E

暴力

 //#pragma comment(linker, "/STACK:102400000, 102400000")
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;
typedef long long LL;
typedef pair <int, int> P;
const int N = 1e5 + ;
int a[];
LL ans, p[] = {, , , , , , , , , , }, limit = 1e18; void dfs(int num, int len) {
if(num == ) {
LL res = ;
for(int i = ; i <= len; ++i) {
for(int j = ; j < a[i]; ++j) {
if(limit / p[i] <= res) {
return ;
}
res *= p[i];
}
}
ans = min(ans, res);
return ;
}
for(int i = ; i <= num; ++i) {
if(num % i == ) {
a[len + ] = i;
dfs(num / i, len + );
}
}
} int main()
{
int n;
cin >> n;
if(n == ) {
cout << << endl;
return ;
} else if(n == ) {
cout << << endl;
return ;
}
ans = limit;
for(int i = ; i <= n; ++i) {
if(n % i == ) {
a[] = i;
dfs(n/i, );
}
}
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 搜索+数论

    题目链接 首先要知道一个性质, 一个数x的因子个数等于 a1^p1 * a2^p2*....an^pn, ai是x质因子, p是质因子的个数. 然后就可以搜了 #include <iostrea ...

  3. 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 ...

  4. 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. 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 ...

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

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

  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. 多个MapReduce作业相互依赖时,使用JobControl进行管理

    要处理复杂关系的数据,一个工程里面绝对不止一个MapReduce作业,当有多个MapReduce作业时,       并且每个作业之间有依赖关系,所谓的依赖就是一个作业得到的结果是另外一个作业的输入, ...

  2. [转载]mysql的binlog安全删除

    [转载]mysql的binlog安全删除  理论上,应该在配置文件/etc/my.cnf中加上binlog过期时间的配置项,expire_logs_days = 10 但是如果没有加这一项,随着产生越 ...

  3. IOS中UISearchBar的使用

    1.搜索框的代理(delegate)方法 #pragma mark 监听搜索框的文字改变 - (void)searchBar:(UISearchBar *)searchBar textDidChang ...

  4. 移植yaffs文件系统

    需要下载yaffs2-d43e901.tar.gz,busybox-1.13.0.tar.bz2 使用的交叉编译器是4.33 1.修改配置编译busybox 修改Makefile CROSS_COMP ...

  5. php多种实例理解无限极分类

  6. margin collapse 之父子关系的DIV

    打算花点时间将知识整理一下,虽然平时现用现查都能完成工作,可是当遇到面试这种事情的时候,临时查就来不及了... 关于margin,整理若干知识点如下: 一:父子关系的DIV标签以及未加margin时的 ...

  7. POJ 1942 Paths on a Grid

    // n*m 的格子 从左下角走到右上角的种数// 相当于从 n+m 的步数中选 m 步往上走// C(n+m,m) #include <iostream> #include <st ...

  8. 扩容盘、SD卡扩容

    内存卡的前世今生回想当年,大家都还在用着非智能机,由于功能单一,需要存储的数据也就是通讯录和短信.虽然那时也有手机游戏,但大多都是几十KB,并不需要太大的存储空间.但随着手机功能的多样化,尤其是音乐. ...

  9. Hadoop1.1.2伪分布式安装笔记

    一.设置Linux的静态IP 修改桌面图标修改,或者修改配置文件修改 1.先执行ifconfig,得到网络设备的名称eth0 2.编辑/etc/sysconfig/network-scripts/if ...

  10. JBPM4入门——7.等待节点的单条线手动执行

    本博文只是简要对JBPM4进行介绍,如需更详细内容请自行google 链接: JBPM入门系列文章: JBPM4入门——1.jbpm简要介绍 JBPM4入门——2.在eclipse中安装绘制jbpm流 ...