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的概 ...
随机推荐
- 大数据-KNN算法
KNN是通过测量不同特征值之间的距离进行分类.它的思路是:如果一个样本在特征空间中的k个最相似(即特征空间中最邻近)的样本中的大多数属于某一个类别,则该样本也属于这个类别,其中K通常是不大于20的整数 ...
- delphi基础篇之项目文件
delphi基础篇之项目文件 program Teacher2018; uses Forms, Unit1 in 'Unit1.pas' {Form1}, Unit2 in 'Unit2.pa ...
- 细数Intellij Idea10个蛋疼问题!
Intellij Idea以下简称IJ. 昨天细数了IJ上的10大666的姿势,IJ确实很智能,在很多方便可以完爆Eclipes,可在某些方面真的被Eclipse秒杀 1.乱码 在Eclipse中很少 ...
- 006-Java的break和continue
break 和 continue关键字的使用 break: 结束当前循环 continue:结束当次循环 示例如下 class JavaTest{ public static void main(St ...
- Docker学习のDocker初识
一.Docker是什么 Docker 是一个开源的应用容器引擎,基于 Go 语言 并遵从Apache2.0协议开源. Docker 可以让开发者打包他们的应用以及依赖包到一个轻量级.可移植的容器中,然 ...
- sparkStreaming结合SparkSql实例
SparkSQL结合SparkStreaming的使用 Flume+Kafka+SparkStreaming已经发展为一个比较成熟的实时日志收集与计算架构,利用Kafka,即可以支持将用于离线分析的数 ...
- iOS音频开发系列-概述篇
概述 iOS中对于音频的处理,苹果提供了两个库. AVFoundation AudioToolbox 在iOS系统中apple对上述的流程进行了封装并提供了不同层次的接口
- shell 脚本 变量使用,取消一个变量,echo
1. 用户自定义变量,直接使用,赋值的时候等号两边不能有空格 A=100 echo "\$A = $A" # $是取变量A 中的值 "" 号中 \$ 是转译,此 ...
- Java Collection - HashMap
HashMap源码解析 java.util.HashMap 类 https://www.cnblogs.com/ysocean/p/8711071.html HashMap线程不安全的原因 https ...
- 关于Cadence OrCad 16.6的破解
相信很多人都知道去老吴的博客上找安装包和破解文件,但是上面的自称一键式破解程序.以及破解图文说明,都是很有问题的. 首先,该一键式破解程序默认的文件后缀与该程序指向的安装压缩包后缀不一致:其次,该程序 ...