码迷,mamicode.com
首页 >  
搜索关键字:poj 2287 贪心    ( 27395个结果
poj1182
题目链接: http://poj.org/problem?id=1182 题目为:      食物链 Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 42412   Accepted: 12366 Description 动物王国中有三类动物A,B,...
分类:其他好文   时间:2014-05-26 04:53:29    阅读次数:236
LeetCode: Pow(x, n) [049]
【题目】 Implement pow(x, n). 【题意】 实现pow(x, n) 【思路】 最直接的思路是用一个循环,乘n次的x。 当n的值较小的时候还好,当n非常大时,时间成本就非常高。加入n=INT_MAX, 也就是21亿多次循环,你可以试想一下。 在这种情况下,我们需要快速的乘完n个x,采用尝试贪心的方法,即滚雪球方式的翻倍相乘 注意:几种特殊情况 1. n=0; 2. n<0;...
分类:其他好文   时间:2014-05-26 04:37:31    阅读次数:212
POJ 1182 食物链【并查集】
题目链接:http://poj.org/problem?id=1182 POJ 1182...
分类:其他好文   时间:2014-05-26 04:28:36    阅读次数:152
poj 1062 昂贵的聘礼
昂贵的聘礼 Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 35274   Accepted: 10098 Description 年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿...
分类:其他好文   时间:2014-05-26 04:04:54    阅读次数:189
POJ分类
初期: 一.基本算法:      (1)枚举. (poj1753,poj2965)      (2)贪心(poj1328,poj2109,poj2586)      (3)递归和分治法.      (4)递推.      (5)构造法.(poj3295)      (6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996) 二.图算法:   ...
分类:其他好文   时间:2014-05-25 01:58:06    阅读次数:247
10382 - Watering Grass(贪心 区间覆盖问题)洒水面覆盖
double qiuzhi(int id) { double t1=cc[id].rid*cc[id].rid; double t2=w*w/4; double t3=t1-t2; double t4=sqrt(t3); return t4; } void to_qujian() { for(int i=0; i<t; i++) { ...
分类:其他好文   时间:2014-05-24 23:23:20    阅读次数:363
poj 2985 The k-th Largest Group 求第K大数 Treap, Binary Index Tree, Segment Tree
题目链接:点击打开链接 题意:有两种操作,合并集合,查询第K大集合的元素个数。(总操作次数为2*10^5) Treap模板(静态数组) #include #include #include #include #include const int maxNode = 500000 + 100; const int inf = 0x3f3f3f3f; struct Tr...
分类:其他好文   时间:2014-05-24 23:18:09    阅读次数:522
poj 3463 Sightseeing(最短路+次短路)
http://poj.org/problem?id=3463 大致题意:给出一个有向图,从起点到终点求出最短路和次短路的条数之和。 解法: 用到的数组:dis[i][0]:i到起点的最短路,dis[i][1]:i到起点的严格次短路 vis[i][0],vis[i][1]:同一维的vis数组,标记距离是否已确定 sum[i][0]:i到起点的最短路条数,sum[i][1]:...
分类:其他好文   时间:2014-05-24 21:50:31    阅读次数:287
poj 2401 划分树 求区间第k大的数
题目:http://poj.org/problem?id=2104 划分树待我好好理解下再写个教程吧,觉得网上的内容一般,,, 模板题: 贴代码: #include #include #include #include using namespace std; #define CLR(a) memset(a,0,sizeof(a)) const int MAXN = 100010...
分类:其他好文   时间:2014-05-24 18:10:18    阅读次数:276
poj 1125 Stockbroker Grapevine
Stockbroker Grapevine Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 25611   Accepted: 14145 Description Stockbrokers are known to overreact to rumours. Y...
分类:其他好文   时间:2014-05-24 17:51:49    阅读次数:249
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!