HDU 4133
2024-08-31 08:59:57
注意题目中的一句话: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;
}
最新文章
- Redis使用及优化入门
- 【转】Android应用开发之PNG、IconFont、SVG图标资源优化详解
- wx菜单栏
- 我的Android开发相关文章
- HTML5 canvas中的路径方法
- Laravel资料
- LeetCode(32)-Binary Tree Level Order Traversal
- 学习 Spring (十七) Spring 对 AspectJ 的支持 (完结)
- 2019年1月6日 没有nainai吃 习题1
- ng4.0 使用[innerHTML]动态插入的富文本如何设置样式
- Python类方法、静态方法与实例方法 -----类里面不需要实例化参数 和没带self的函数 调用此函数的方法
- 微信小程序云开发之云函数创建
- STL——迭代器与traits编程技法
- HDU 2504 又见GCD (最大公因数+暴力)
- kaldi DNN在线解码 aishell为例
- Ubuntu打开core dump
- p2319 [HNOI2006]超级英雄
- c# 闲谈异常处理
- macOS中Vim基本配置,颜色主题/语法/indent设置
- phpmyadmin后台4种拿shell方法 &;&; php爆路径大法