HDU 4344-Mark the Rope-大数素因子分解
注意只有一个素因子的情况。
#include <cstdio>
#include <algorithm>
#include <cstring> using namespace std; typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 4e3+;
struct cake
{
int w,l;
cake(){}
bool operator < (const cake &b) const
{
return l > b.l;
}
}ck[maxn]; int N,len[maxn]; int main()
{
scanf("%d",&N); for(int i=;i<N;i++)
{
scanf("%d%d",&ck[i].w,&ck[i].l);
if(ck[i].w > ck[i].l) swap(ck[i].w,ck[i].l);
} sort(ck,ck+N); int m;
int answ,ansl;
ll ans = -INF; for(int i=;i<N;i++)
{
m = ;
for(int j=;j<N;j++)
{
if(ck[j].w >= ck[i].w)
{
len[m++] = ck[j].l;
}
}
for(int j=;j<m;j++)
{
ll res = (ll)ck[i].w*len[j]*(j+);
if(res > ans)
{
ans = res;
answ = ck[i].w;
ansl = len[j];
}
}
}
printf("%I64d\n%d %d\n",ans,answ,ansl); }
HDU 4344-Mark the Rope-大数素因子分解的更多相关文章
- Miller&&Pollard HDOJ 4344 Mark the Rope
题目传送门 题意:一个长为n(n<2^63)的管子,在管子上做标记,每隔L个长度单位做一个标记,从管子头端开始,保证最后一次标记恰好在管子的尾端.让你找出有多少个这样的L(L<n),且他们 ...
- 【HDU - 4344】Mark the Rope(大整数分解)
BUPT2017 wintertraining(15) #8E 题意 长度为n(\(n<2^{63}\))的绳子,每隔长度L(1<L<n)做一次标记,标记值就是L,L是n的约数. 每 ...
- HDU 4344 大数分解大素数判定
这里贴个模板吧.反正是不太理解 看原题就可以理解用法!! #include <cstdio> #include <iostream> #include <algorith ...
- HDU 1041 Computer Transformation (简单大数)
Computer Transformation http://acm.hdu.edu.cn/showproblem.php?pid=1041 Problem Description A sequenc ...
- hdu 4873 ZCC Loves Intersection(大数+概率)
pid=4873" target="_blank" style="">题目链接:hdu 4873 ZCC Loves Intersection ...
- HDU高精度总结(java大数类)
HDU1002 A + B Problem II [题意]大数相加 [链接]http://acm.hdu.edu.cn/showproblem.php?pid=1002 Sample Inpu ...
- HDU 1314 Numerically Speaking(大数加减乘除+另类二十六进制互相转换)
原题代号:HDU 1314 原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1314 Numerically Speaking Time Limit: 2 ...
- HDU 1131 Count the Trees 大数计算
题目是说给出一个数字,然后以1到这个数为序号当做二叉树的结点,问总共有几种组成二叉树的方式.这个题就是用卡特兰数算出个数,然后因为有编号,不同的编号对应不同的方式,所以结果是卡特兰数乘这个数的阶乘种方 ...
- HDU 5568 sequence2 区间dp+大数
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5568 题意: 求所有长度为k的严格升序子序列的个数. 题解: 令dp[i][k]表示以i结尾的长度为 ...
- hdu 4099 Revenge of Fibonacci 大数+压位+trie
最近手感有点差,所以做点水题来锻炼一下信心. 下周的南京区域赛估计就是我的退役赛了,bless all. Revenge of Fibonacci Time Limit: 10000/5000 MS ...
随机推荐
- ML.NET 示例:聚类之客户细分
写在前面 准备近期将微软的machinelearning-samples翻译成中文,水平有限,如有错漏,请大家多多指正. 如果有朋友对此感兴趣,可以加入我:https://github.com/fei ...
- matplotlib 入门之Sample plots in Matplotlib
文章目录 Line Plot One figure, a set of subplots Image 展示图片 展示二元正态分布 A sample image Interpolating images ...
- Floyd最短路(带路径输出)
摘要(以下内容来自百度) Floyd算法又称为插点法,是一种利用动态规划的思想寻找给定的加权图中多源点之间最短路径的算法,与Dijkstra算法类似. 该算法名称以创始人之一.1978年图灵奖获得者. ...
- ElasticSearch 分组查询的几个例子
facets接口可以根据query返回统计数据,其中的 terms_stats 是分组统计,根据key的情况返回value的统计数据,类似group by的意思. "terms_stats& ...
- Pair Project
以前只是一个人完成一个项目,不论什么都是,现在突然要两个人一起来写, 听上去挺稀奇的,也挺简单的,可惜了就是“听上去”而已.我认为这也是一种技术啊~ 我跟我的搭档研究了好久好久,选择了好久,然后也选了 ...
- Hadoop01的主要总结
Hadoop (离线) 分布式的计算框架 scala---spark(实时计算框架)
- Java 读取配置文件数据
Properties类 Properties类,是一个工具类,包含在java.util包中. 功能:可以保存持久的属性,通常用来读取配置文件或者属性文件,将文件中的数据读入properties对象中, ...
- 【问题解决方案】本地代码文件上传到GitHub里中文乱码问题
刚刚学完Git并试着上传了我的化石Java代码到远程库,表面一切和谐,然而.. 真让人大惊失色.. step1-检查浏览器是否是utf-8(谷歌默认是) step2-在本地编辑器设置 (按理说,not ...
- Python中Celery 的基本用法以及Django 结合 Celery 的使用和实时监控进程
celery是什么 1 celery是一个简单,灵活且可靠的,处理大量消息的分布式系统 2 专注于实时处理的异步任务队列 3 同时也支持任务调度 执行流程 Celery 基本使用 tasks.py i ...
- nginx 1.4.3能直接升到1.8.1吗
nginx 1.4.3能直接升到1.8.1吗_百度知道https://zhidao.baidu.com/question/564529441847261484.html nginx-1.6.3平滑升级 ...