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的更多相关文章

  1. Codeforces 27E. Number With The Given Amount Of Divisors (暴力)

    题目链接:http://codeforces.com/problemset/problem/27/E 暴力 //#pragma comment(linker, "/STACK:1024000 ...

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

  3. codeforces 27E . Number With The Given Amount Of Divisors 搜索+数论

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

  4. CodeForces - 27E--Number With The Given Amount Of Divisors(反素数)

    CodeForces - 27E Number With The Given Amount Of Divisors Submit Status Description Given the number ...

  5. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  6. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  7. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

  8. 【Codeforces 738A】Interview with Oleg

    http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...

  9. CodeForces - 662A Gambling Nim

    http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...

随机推荐

  1. mysql 导出导入数据 -csv

    MySql数据库导出csv文件命令: mysql> select first_name,last_name,email from account into outfile 'e://output ...

  2. Flink 1.6.0 Windows操作

    原文连接 https://ci.apache.org/projects/flink/flink-docs-release-1.6/dev/stream/operators/windows.html W ...

  3. 牛客练习赛43D Tachibana Kanade Loves Sequence

    题目链接:https://ac.nowcoder.com/acm/contest/548/D 题目大意 略 分析 贪心,首先小于等于 1 的数肯定不会被选到,因为选择一个数的代价是 1,必须选择大于1 ...

  4. 跳一跳外挂的python实现--OpenCV步步精深

    去我的个人网站看看吧 http://opencvblog.com/跳一跳外挂-python实现/ 都在这里啦

  5. Linux安全审计-基础篇

    安全审计这块我能想到的有两种方案可以解决,一种是在Linux中配置实现,一种是使用Python开发堡垒机实现,我先实现了第一种比较简单的:后面会开发堡垒机:   一.首先我们需要在/etc/profi ...

  6. 如何通过SVN管理好代码

    来自:http://blog.csdn.net/baronyang/article/details/6942434 ------------------------------------------ ...

  7. java OOP第03章_继承、抽象类和抽象方法

    一. 为什么需要继承: 若多个类中都需要一些属性和方法,那么就可以将属性和方法抽取到一个父类中,需要的子类可以通过extends关键字去继承这个父类后拥有相应的属性和方法. 类.数组.方法----引用 ...

  8. JS对象 数组连接 concat() 方法用于连接两个或多个数组。此方法返回一个新数组,不改变原来的数组。 语法 arrayObject.concat(array1,array2,.arrayN)

    concat() 方法用于连接两个或多个数组.此方法返回一个新数组,不改变原来的数组. 语法 arrayObject.concat(array1,array2,...,arrayN) 参数说明: 注意 ...

  9. C# 调用java的Webservice时关于非string类型处理

    比如webservice地址是:http://wdft.com:80/services/getOrderService1.0?wsdl 方法是:getOrder 1.首先添加引用: 2. 3.引用完成 ...

  10. Python自学:第五章 对数字列表执行简单的统计计算

    >>>digits = [1,2,3,4,5,6,7,8,9,0] >>>mid(digits) 0 >>>max(digits) 9 >& ...