51nod 1060反素数
经典题。
#include<map>
#include<queue>
#include<stack>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define INF 1000000001
#define ll unsigned long long
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
using namespace std;
const int MAXN = ;
int prime[]={,,,,,,,,,,,,,,,,,,,};
ll n;
ll ans,ans_cnt;
void getarcprime(ll cur,ll cnt,int limit,int k)
{
if(cur > n)return;
if(cnt > ans_cnt){
ans_cnt = cnt;
ans = cur;
}
else if(cnt == ans_cnt && cur < ans){
ans = cur;
}
for(int i = ; i <= limit; i++){
if(n / prime[k] < cur){
return;
}
getarcprime(cur*prime[k],cnt*(i+),i,k+);
cur = cur*prime[k];
}
}
int main()
{
int t;
cin >>t;
while(t--){
cin >>n;
ans = ;
ans_cnt = ;
getarcprime(,,,);
cout<<ans<<" "<<ans_cnt<<endl;
}
return ;
}
51nod 1060反素数的更多相关文章
- 51nod 1060 最复杂的数(数论,反素数)
题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1060 题解:可以去学习一下反素数. #include < ...
- 51nod 1060 最复杂的数 反素数
1060 最复杂的数 基准时间限制:1 秒 空间限制:131072 KB 把一个数的约数个数定义为该数的复杂程度,给出一个n,求1-n中复杂程度最高的那个数. 例如:12的约数为:1 2 3 4 6 ...
- 1060 最复杂的数(反素数玄学dfs)
1060 最复杂的数 题目来源: Ural 1748 基准时间限制:1 秒 空间限制:131072 KB 分值: 40 难度:4级算法题 把一个数的约数个数定义为该数的复杂程度,给出一个n,求1-n中 ...
- 51nod1060(反素数&dfs)
题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1060 题意:中文题诶- 思路: 这里用到了反素数的性质: 对 ...
- bzoj1053: [HAOI2007]反素数ant
51nod有一道类似的题...我至今仍然不会写暴搜!!! #include<cstdio> #include<cstring> #include<iostream> ...
- 【POJ2886】Who Gets the Most Candies?-线段树+反素数
Time Limit: 5000MS Memory Limit: 131072K Case Time Limit: 2000MS Description N children are sitting ...
- Prime & 反素数plus
题意: 求因数个数为n的最小正整数k. n<=10^9输出其唯一分解形式 SOL: 模拟题,一眼看过去有点惊讶...这不是我刚看过的反素数吗... 咦数据怎么这么大,恩搞个高精吧... 于是T了 ...
- BZOJ 1053 & 反素数
题意: 反素数,膜一篇GOD's Blog...http://blog.csdn.net/ACdreamers/article/details/25049767 此文一出,无与争锋... CODE: ...
- Who Gets the Most Candies?(线段树 + 反素数 )
Who Gets the Most Candies? Time Limit:5000MS Memory Limit:131072KB 64bit IO Format:%I64d &am ...
随机推荐
- u3d单词学习plane
plane n.水平: 平面: 飞机: 木工刨
- android ndk 无法找到 so 案例一例
代码如下: public class JNIWrapWorkerThread{ static { System.loadLibrary("libjni_base_fram ...
- 个人PHP开发环境的选择与搭建
入职一个多月,重新调整了一下自己电脑的开发环境,现在写出来,算是作为自己的笔记. 如果你是该文章的读者,请忍受文章内的所有小章节都没有具体的步骤. 因为平时还要打游戏(划掉),所以电脑系统一直是Win ...
- EEG montage
Source: WikiPedia - Electroencephalography Since an EEG voltage signal represents a difference betwe ...
- usb驱动开发23之驱动生命线
关于字符串描述符的地位仅次于设备/配置/接口/端点四大描述符,那四大设备必须得支持,而字符串描述符对设备来说则是可选的,这并不是就说字符串描述符不重要,对咱们来说,提供字符串描述符的设备要比没有提供的 ...
- Android动画学习笔记-Android Animation
Android动画学习笔记-Android Animation 3.0以前,android支持两种动画模式,tween animation,frame animation,在android3.0中 ...
- Python.Django视频教程(全13集)
Python.Django视频教程(全13集)教程目录: 下载地址:http://www.fu83.cn/thread-205-1-1.html
- 一道int与二进制加减题
int dis_data = 32769; if( dis_data > 0x7fff) dis_data -= 0xffff; printf("%d\n",dis_dat ...
- 如何重现难以重现的bug
生活中有这么一种现象:如果你关注某些东西,它就会经常出现在你眼前,例如一个不出名的歌手的名字,一种动物的卡通形象,某个非常专业的术语,等等等等.这种现象也叫做“孕妇效应”.还有类似的一种效应叫做“视网 ...
- 翻译qmake文档(三) Creating Project Files
翻译qmake文档 目录 原英文文档:http://qt-project.org/doc/qt-5/qmake-project-files.html 创建项目文件 项目文件包含qmake构建你 ...