经典题。

#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反素数的更多相关文章

  1. 51nod 1060 最复杂的数(数论,反素数)

    题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1060 题解:可以去学习一下反素数. #include < ...

  2. 51nod 1060 最复杂的数 反素数

    1060 最复杂的数 基准时间限制:1 秒 空间限制:131072 KB 把一个数的约数个数定义为该数的复杂程度,给出一个n,求1-n中复杂程度最高的那个数. 例如:12的约数为:1 2 3 4 6 ...

  3. 1060 最复杂的数(反素数玄学dfs)

    1060 最复杂的数 题目来源: Ural 1748 基准时间限制:1 秒 空间限制:131072 KB 分值: 40 难度:4级算法题 把一个数的约数个数定义为该数的复杂程度,给出一个n,求1-n中 ...

  4. 51nod1060(反素数&dfs)

    题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1060 题意:中文题诶- 思路: 这里用到了反素数的性质: 对 ...

  5. bzoj1053: [HAOI2007]反素数ant

    51nod有一道类似的题...我至今仍然不会写暴搜!!! #include<cstdio> #include<cstring> #include<iostream> ...

  6. 【POJ2886】Who Gets the Most Candies?-线段树+反素数

    Time Limit: 5000MS Memory Limit: 131072K Case Time Limit: 2000MS Description N children are sitting ...

  7. Prime & 反素数plus

    题意: 求因数个数为n的最小正整数k. n<=10^9输出其唯一分解形式 SOL: 模拟题,一眼看过去有点惊讶...这不是我刚看过的反素数吗... 咦数据怎么这么大,恩搞个高精吧... 于是T了 ...

  8. BZOJ 1053 & 反素数

    题意: 反素数,膜一篇GOD's Blog...http://blog.csdn.net/ACdreamers/article/details/25049767 此文一出,无与争锋... CODE: ...

  9. Who Gets the Most Candies?(线段树 + 反素数 )

    Who Gets the Most Candies? Time Limit:5000MS     Memory Limit:131072KB     64bit IO Format:%I64d &am ...

随机推荐

  1. Unity官网教程之Tips

    前言 翻译整理unity官网教程的tips部分,原文:http://unity3d.com/cn/learn/tutorials/topics/tips Snap 按住Ctrl键,并用鼠标拖动Game ...

  2. Windows系统小知识

    前言 本文写作于Window10发布后的2015-08-01,新系统发布后我做了新系统的小白鼠,所以写此文以作记录. WIN10各版本下载地址:http://www.ithome.com/html/w ...

  3. wamp5设置外网访问方法

    1.安装完Wamp5之后,从外网访问网页时存在无法访问问题. 2.phpmyadmin外网没法访问 1.解决办法: 打开wamp的托盘图标(右下角),找到"Config files" ...

  4. CSS中单位px和em,rem的区别

    PX特点: 1 IE无法调整那些使用px作为单位的字体大小: 2. 国外的大部分网站能够调整的原因在于其使用了em或rem作为字体单位: 3. Firefox能够调整px和em,rem,但是96%以上 ...

  5. 原创:Eclipse 上网代理设置(亲测有效)

    直接上图:

  6. SPM FDR校正

    来源: http://blog.sciencenet.cn/blog-479412-572049.html,http://52brain.com/thread-15512-1-1.html SPM8允 ...

  7. html之marquee详解

    该标签不是HTML3.2的一部分,并且只支持MSIE3以后内核,所以如果你使用非IE内核浏览器(如:Netscape)可能无法看到下面一些很有意思的效果该标签是个容器标签语法: <marquee ...

  8. tomcat配置文件详解

    Tomcat系列之服务器的安装与配置以及各组件详解   tomcat 配置文件详解

  9. GET请求参数为中文时乱码分析

    问题描述 近期做任务时,跟后端联调时遇到一个问题,前端发送get请求,当参数值有中文时,请求失败,请求参数变为乱码.(ps:一般当参数有中文时,很少使用get请求,而是使用post请求来传输数据,请求 ...

  10. 本地的html怎么直接通过路径就读取本地文件。

    我要做的事情是已知一个目录的相对路径,获得这个路径下面所有的txt文件,然后读到一个JS Script里面做下一步处理. 网上的例子都是使用input的,既然我是local的html文件,也知道路径了 ...