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. oracle一体机(exdata)创建ACFS文件系统

    ACFS是一个支持多个平台,可扩展的,基于ORACLE ASM的集群文件系统,可以用来存储数据库和各种应用的文件,包括数据库的trace文件,alert日志文件和配置文件等等,也可以用来存储视频,音频 ...

  2. Ulimit 文件配置

    cat /etc/security/limits.confsudo vim /etc/security/limits.conf * hard nofile 999999 * soft nofile 9 ...

  3. mybatis 处理CLOB/BLOB类型数据

    BLOB和CLOB都是大字段类型. BLOB是按二进制来存储的,而CLOB是可以直接存储文字的. 通常像图片.文件.音乐等信息就用BLOB字段来存储,先将文件转为二进制再存储进去.文章或者是较长的文字 ...

  4. Codeforces 479【A】div3试个水

    题目链接:http://codeforces.com/problemset/problem/977/A 题意:这个题,题目就是让你根据他的规律玩嘛.末尾是0就除10,不是就-1. 题解:题解即题意. ...

  5. 免费的高分辨率图库——re:splashed 可用做网页背景、设计或桌面壁纸

    想找高清图片用作网站背景.设计或桌面壁纸?可以去re:splashed看看.re:splashed 是一个提供免费高分辨率HD图片的网站,有多种分类标签,查找很方便,无需注册和登陆便可下载. 网站名称 ...

  6. VBA字典做数据有效性

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)If Target.Column = 26 And Range("f& ...

  7. The linux command 之软件包管理

    一.软件包系统 不同的Linux发行版用的是不同的软件包系统,多数都采用以下两种: 二.软件包系统工具 三.在库里查找软件包 四.安装库中的软件包 五.安装软件包文件中的软件包 六.删除软件包 七.更 ...

  8. Nginx配置两份日志记录

    nginx配置 版本-1.4.4 --- access_log /alidata/log/nginx/access/wordpress1.log ; access_log /alidata/log/n ...

  9. C# - Finalize 和 Dispose

    重要: https://www.cnblogs.com/Jessy/articles/2552839.html https://blog.csdn.net/daxia666/article/detai ...

  10. Windows copy

    将一份或多份文件复制到另一个位置. COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/L] [/A | /B ] source [/A | /B]     [+ source ...