Codeforces 27E. Number With The Given Amount Of Divisors (暴力)
题目链接: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 (暴力)的更多相关文章
- 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 ...
- codeforces 27E . Number With The Given Amount Of Divisors 搜索+数论
题目链接 首先要知道一个性质, 一个数x的因子个数等于 a1^p1 * a2^p2*....an^pn, ai是x质因子, p是质因子的个数. 然后就可以搜了 #include <iostrea ...
- 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 ...
- 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 ...
- 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 ...
- codeforces 27 E. Number With The Given Amount Of Divisors(数论+dfs)
题目链接:http://codeforces.com/contest/27/problem/E 题意:问因数为n个的最小的数是多少. 题解:一般来说问到因数差不多都会想到素因子. 任意一个数x=(p1 ...
- 大家一起做训练 第一场 E Number With The Given Amount Of Divisors
题目来源:CodeForce #27 E 题目意思和题目标题一样,给一个n,求约数的个数恰好为n个的最小的数.保证答案在1018内. Orz,这题训练的时候没写出来. 这道题目分析一下,1018的不大 ...
- 【数学】【CF27E】 Number With The Given Amount Of Divisors
传送门 Description 给定一个正整数\(n\),输出最小的整数,满足这个整数有n个因子 Input 一行一个整数\(n\) Output 一行一个整数,代表答案. Hint \(1~\leq ...
- 数论 CF27E Number With The Given Amount Of Divisors
求因子数一定的最小数(反素数) #include<iostream> #include<string> #include<cmath> #include<cs ...
随机推荐
- hdu4605 magic ball game 树状数组+离线处理
题意:给你一棵二叉树,每个节点有一个w值,现在有一颗小球,值为x,从根节点往下掉,如果w==x,那么它就会停止:如果w>x,那么它往左.右儿子的概率都是1.2:如果w<x,那么它往左儿子的 ...
- 同步内核缓冲区sync、fsync和fdatasync函数
转自http://www.2cto.com/os/201409/339460.html 同步内核缓冲区 1.缓冲区简介 人生三大错觉之一:在调用函数write()时,我们认为该函数一旦返回,数据便已经 ...
- ORACLE clusterware组成
oracle cluterware是一个单独的安装包,一旦安装部署好后,每个节点上的oracle cluterware会自动启动,oracle cluterware的运行环境由两个磁盘文件,若干后台进 ...
- MySQL的事件调度器
自MySQL5.1.0起,增加了一个非常有特色的功能–事件调度器(Event Scheduler),可以用做定时执行某些特定任务,可以看作基于时间的触发器. 一.开启 事件调度默认是关闭的,开启可执行 ...
- 使用JQuery Mobile实现手机新闻浏览器
jQuery Mobile项目是jQuery项目下的在移动开发方面的又一力作,在本文中,笔者将带你一步步更深入学习使用jQuery Mobile框架去实现一个能在android手机上运行的新闻浏览器, ...
- window 7 下一台cp 两个mysql 配置主从
环境 : 个人 pc windows7 一台 ; 使用 : 官方下载: mysql-noinstall-5.5.11-win32.zip 1. 解压 成2个 (文件夹) mysql_master (主 ...
- C#隐式运行CMD命令(隐藏命令窗口)
原文 C#隐式运行CMD命令(隐藏命令窗口) 本文实现了C#隐式运行CMD命令的功能.下图是实例程序的主画面.在命令文本框输入DOS命令,点击"Run"按钮,在下面的文本框中输出运 ...
- Maps
Maps.uniqueIndex()将列表转换为map //iterator各个元素作为Map.values, key为Function.apply返回值 Maps.uniqueIndex(ps.i ...
- XRPictureBox z
XRPictureBox 大小加入是40x40 我绑定的图片好比是60X50 , 在不自己写代码的情况下,XRPictureBox 有没有什么属性可以调整,比如像SizeMode那种? // Set ...
- hdu 2602 Bone Collector(01背包)
题意:给出包裹的大小v,然后给出n块骨头的价值value和体积volume,求出一路下来包裹可以携带骨头最大价值 思路:01背包 1.二维数组(不常用 #include<iostream> ...