CodeForces - 27E
https://vjudge.net/problem/CodeForces-27E
求因子个数为n的最小的数
dfs枚举质因子的幂
#include <iostream>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#define inf ~0
#define N 1000010
#define p(a) putchar(a)
#define For(i,a,b) for(unsigned long long i=a;i<=b;++i) using namespace std;
unsigned long long n,ans;
unsigned long long prime[]={,,,,,,,,,,,,,,,};
void in(unsigned long long &x){
unsigned long long y=;char c=getchar();x=;
while(c<''||c>''){if(c=='-')y=-;c=getchar();}
while(c<=''&&c>=''){ x=(x<<)+(x<<)+c-'';c=getchar();}
x*=y;
}
void o(unsigned long long x){
if(x<){p('-');x=-x;}
if(x>)o(x/);
p(x%+'');
} void dfs(unsigned long long depth,unsigned long long num,unsigned long long cnt,unsigned long long up){
if(cnt>n)
return;
if(cnt==n&&ans>num){
ans=num;
return;
}
For(i,,up){
if(num*prime[depth]>ans) return;
dfs(depth+,num*=prime[depth],cnt*(i+),i);
}
} int main(){
in(n);
ans=inf;
dfs(,,,);
o(ans);
return ;
}
CodeForces - 27E的更多相关文章
- Codeforces 27E. Number With The Given Amount Of Divisors (暴力)
题目链接:http://codeforces.com/problemset/problem/27/E 暴力 //#pragma comment(linker, "/STACK:1024000 ...
- 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 - 27E--Number With The Given Amount Of Divisors(反素数)
CodeForces - 27E Number With The Given Amount Of Divisors Submit Status Description Given the number ...
- python爬虫学习(5) —— 扒一下codeforces题面
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...
- 【Codeforces 738D】Sea Battle(贪心)
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...
- 【Codeforces 738C】Road to Cinema
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...
- 【Codeforces 738A】Interview with Oleg
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...
- CodeForces - 662A Gambling Nim
http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...
随机推荐
- nc命令官方Demo实例
nc命令可用于发送任务tcp/udp连接和监听. 官方描述的主要功能包括: simple TCP proxies shell-script based HTTP clients and servers ...
- hexo next主题深度优化(十一),next主题中加入scrollReveal.js,让文章随着鼠标的滚动,出现点小动作。
文章目录 效果 scrollReveal简单介绍以及简单操作 参考文档: next主题中加入scrollReveal 给article标签添加属性 给底部的不蒜子添加属性 本地引入依赖并且编写启动函数 ...
- markdown开篇
def show(): print("你好世界!") print("实习的日子还是得好好学习呀!") print("加油 各位!")
- js实现下拉框
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 20140401 cudaHOG代码
1.cudaHOG代码(删减没有必要的目录) cudaHOGDetect需要boost库:boost_date_time-vc100-mt-1_40.lib VC++目录->附加库目录D:\bo ...
- 活动:月末送Java技术书福利|抽奖
本公众号运营了快一年了 原创干货超过200+ 收获了也快1W粉丝 这么多粉丝-- 送书活动怎能少? 虽然这次我们是有备而来 但是-- 所有书籍为作者自掏腰包 所以本次送书数量有限 不能满足到所有人 重 ...
- C++之程序流程_选择结构
C/C++支持最基本的三种程序运行结构:==顺序结构.选择结构.循环结构== * 顺序结构:程序按顺序执行,不发生跳转* 选择结构:依据条件是否满足,有选择的执行相应功能* 循环结构:依据条件是否满足 ...
- 买不到的数目 /// 结论公式 oj26316
题目大意: 给定a b(这题题意不清 其实a b互质) 设变量x y(x>=0,y>=0),求 x*a+y*b=c 找到最大的不可能达到的c 如a=4 b=7 那么c=14 有这样一个定理 ...
- mysql UDF提权问题
测试UDF提权,时候遇到问题,创建函数shell提示存在 当执行操作的时候又提示,shell函数不存在. FUNCTION mysql.shell does not exist 如果在测试环境下,一般 ...
- 获取linux性能数据
import reimport osimport sysimport jsonimport socketfrom urllib import request,parseimport urllibfro ...