题意 质因数只可能有2,3,5的数称为丑数 输出第1500个丑数
STL优队列应用 1是丑数 丑数的2,3,5倍都是丑数 用优先队列模拟就行了
#include
#include
#include
#include
using namespace std;
typedef long long ll;
//priority_queue, greater > q;
struct...
分类:
其他好文 时间:
2015-01-20 22:20:23
阅读次数:
233
Data Structures 基本数据结构Dictionaries 字典Priority Queues 堆Graph Data Structures 图Set Data Structures 集合Kd-Trees 线段树Numerical Problems 数值问题Solving Linear E...
分类:
其他好文 时间:
2015-01-19 14:10:41
阅读次数:
312
Queuing
Time Limit:5000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u
Submit Status
Description
Queues and Priority Queues are data structures which are known to most comp...
分类:
其他好文 时间:
2015-01-17 16:36:07
阅读次数:
201
#include using namespace std;/*priority_queue只允许在底端加入元素,并从顶端取出元素,其内部元素不是依照被推入的次序排列,而是自动按照元素的权值排列,权值最大的元素排在最前面缺省情况下priority_queue是利用一个max_heap完成*/templ...
分类:
其他好文 时间:
2015-01-17 13:51:18
阅读次数:
123
今天帮一个同学的朋友安装win7, 竟然安不上,很久没有出现安不上系统了, 后来发现他的笔记本是新的类型,预先注意事项为:1,启动的时候,使用 Fn+F2进入 BIOS.2,将Boot中的Boot Mode设置为Legacy Support,并将Boot Priority设置为 Legacy Fir...
Merge k Sorted ListsMergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.采用优先队列priority_queue把ListNode放入优先队...
分类:
其他好文 时间:
2015-01-12 23:57:44
阅读次数:
266
题意:
有c有牛,从中选(n-1)/2头,使他们的得分中位数最大且需要的资金援助和不超过f.
分析:
堆的运用大顶堆维护最小和。
代码:
//poj 2010
//sep9
#include
#include
#include
using namespace std;
const int maxN=100024;
int dpl[maxN],dpr[maxN];
priority...
分类:
其他好文 时间:
2015-01-08 13:26:24
阅读次数:
184
private void initImageLoader(){
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
.threadPriority(Thread.NORM_PRIORITY - 2)
.denyCacheImageMultipleSizesInMemory()
...
分类:
其他好文 时间:
2015-01-08 13:23:51
阅读次数:
212
关于failover网上也有很多例子,但是看到的有多重做法,个人觉得,本着职责单一的原则
1、一台机子运行一个flume agent
2、一个agent 的下游sink指向一个flume agent,不要一个flume agent配置多个端口【影响性能】
下面看具体实例:
首先是flumet agent client的配置
priority越高,优先级越高,会优先使用该sink...
分类:
Web程序 时间:
2015-01-07 16:53:24
阅读次数:
220
题意:有若干个颜色,每个颜色有若干头牛。
现在将牛进行配对,使得每对颜色都不一样,有SPJ。
题解:一旦某种颜色的牛数量占当前未配对牛总数最多,那么就要群起而攻之!
利用pq或者heap解决。
代码:
#include
#include
#include
#include
#include
#define N 101000
#define inf 0x3f3f3...
分类:
其他好文 时间:
2014-12-31 10:04:33
阅读次数:
166