HDU 4133
注意题目中的一句话:If a number m has bigger evaluating value than all the numbers smaller than it。。。
这让我重新想过反素数的定义,应该 是比n小的数的约数的个数都 小于 n。所以,应该取最小的一个值
#include <iostream>
#include <cstdio>
#include <algorithm>
#define LL __int64
using namespace std;
LL n,ans,c; LL p[16]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53}; void solve(LL dep, LL tmp, LL num){
if(tmp>n) return ;
if(num>c||(num==c&&tmp<ans)){
ans=tmp;
c=num;
}
// cout<<tmp<<endl;
for(LL i=1;i<=60;i++){
if(tmp*p[dep]>n) break;
solve(dep+1,tmp*p[dep],num*(i+1));
tmp*=p[dep];
}
} int main(){
int t,kase=0;
scanf("%d",&t);
while(t--){
scanf("%I64d",&n);
ans=-1;
c=0;
solve(0,1,1);
printf("Case #%d: %I64d\n",++kase,ans);
}
return 0;
}
HDU 4133的更多相关文章
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
- HDU 4569 Special equations(取模)
Special equations Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 4006The kth great number(K大数 +小顶堆)
The kth great number Time Limit:1000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64 ...
- HDU 1796How many integers can you find(容斥原理)
How many integers can you find Time Limit:5000MS Memory Limit:32768KB 64bit IO Format:%I64d ...
- hdu 4481 Time travel(高斯求期望)(转)
(转)http://blog.csdn.net/u013081425/article/details/39240021 http://acm.hdu.edu.cn/showproblem.php?pi ...
- HDU 3791二叉搜索树解题(解题报告)
1.题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=3791 2.参考解题 http://blog.csdn.net/u013447865/articl ...
- hdu 4329
problem:http://acm.hdu.edu.cn/showproblem.php?pid=4329 题意:模拟 a. p(r)= R'/i rel(r)=(1||0) R ...
随机推荐
- Xmind8破解激活
1.下载安装包: https://www.xmind.cn/download/ 进行安装 2.下载破解补丁: https://stormxing.oss-cn-beijing.aliyuncs.com ...
- Linux系统查看当前时间的命令
转自:https://www.cnblogs.com/redfire/p/7702213.html 一.查看和修改Linux的时区1. 查看当前时区命令 : "date -R"2. ...
- 南海区行政审批管理系统接口规范v0.3(规划) 5.投资项目联合审批系统API 5.1.【uploadFile】证件文书附件上传
- 写个js 分页玩玩(原创)
<ul id="page"> <li class="pagetest">1</li> <li class=" ...
- 二、SQL系列之~常见51道SQL查询语句
[写在前面~~] [PS1:建议SQL初学者一定要自己先做一遍题目,这样才有效果~~(做题时为验证查询结果是否正确,可更改表中数据)] [PS2:文末最后一条代码整合了全部51道题目及答案~~] [P ...
- logrotate配置文件
一.logrotate配置文件 /etc/logrotate.conf
- jQuery基本选择器模块
选择器模块 1.获取元素的基本操作 案例:给页面中的div和p设置边框样式 1.1 传统方式 -获取元素并设置样式 实现思路 1 通过 标签名 获取元素 2 遍历循环 设置样式 var dvs = d ...
- UWP Ad
1.对于 UWP 应用:使用 Visual Studio 2015 安装 Microsoft Store Services SDK 2.对于通用 Windows 平台 (UWP) 项目:展开通用 Wi ...
- AndroidStudio/Intellij 快捷键
说明 三年来一直使用Eclipse作为自己的IDE, 现在是时候走出自己的safety zone, 开始使用传说中的Intellij了. Eclipse/Intellij IDE环境为: OS X 1 ...
- Centos7 执行firewall-cmd –permanent –add-service=mysql报错“ModuleNotFoundError: No module named 'gi'”
因为目前环境Python3.x与Python2.x版本并存,所以导致以上问题. 解决方法: 第一步,vim /usr/bin/firewall-cmd, 将#!/usr/bin/python -Es ...