bzoj 1053 [ HAOI 2007 ] 反素数ant ——暴搜
2024-09-04 00:39:59
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1053
试图打表找规律,但无果...
看TJ了,暴搜;
注意参数 w 是 long long。
代码如下:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
int n,ans,mx,pri[]={,,,,,,,,,};
void dfs(int ps,int cnt,int lst,ll w)//注意w是ll
{
if(cnt>mx)mx=cnt,ans=(int)w;
else if(cnt==mx)ans=min(ans,(int)w);
if(ps>)return;//
for(int i=;i<=lst&&w<=n;i++,w*=pri[ps])
dfs(ps+,cnt*(i+),i,w);
}
int main()
{
scanf("%d",&n);
dfs(,,,);
printf("%d\n",ans);
return ;
}
最新文章
- 基于Dubbo框架构建分布式服务(一)
- c语言自定义BOOL函数
- R语言数据处理利器——dplyr简介
- [DNX]解决dnu restore时找不到Newtonsoft.Json的问题
- dedecms首页调用的简介一直修改不了是自动文章摘要在作怪
- Java_类文件及加载机制
- python3_RoboBrowser_test
- Stream,Reader/Writer,Buffered的区别(1)
- 5个缺失的 JavaScript 数字格式化函数
- 49. Anagrams
- Samba出现“您可能没有权限使用网络资源”解决方法
- 【python】三个变量互换值
- C#中标准Dispose模式的实现
- Java中获得程序当前路径的4中方法
- drwtsn32.exe 遇到问题须要关闭。我们对此引起的不便表示抱歉
- json的js和C#操作
- 理解Java中的抽象
- Eclipse创建Maven项目报错的解决
- Kubernetes 在生产环境中常用架构
- 利用python实现电影推荐