码迷,mamicode.com
首页 > 其他好文
uvalive 4356
题意:有n个点在平面直接坐标线,给出了n个点坐标,然后问以(0,0)为圆心的扇形包含至少k个点最小面积。 题解:贪心,先把所有点按与x轴正半轴的角度排序,然后选出一个点当半径,枚举剩下点(半径小于第一个点),更新最小面积值。 #include #include #include using namespace std; const int N = 5005; const double...
分类:其他好文   时间:2015-03-30 09:27:55    阅读次数:121
poj 4046 Sightseeing 枚举思想在spfa中的应用
题意: 给一个图和q个询问,每个询问查询图中两点的(距离+路径上最大值)的最小值。 分析: 枚举路径上的最大值做spfa,这题丫的卡常数。。。队列用stl的就等着tle吧。 代码: //poj 4046 //sep9 #include #define inf ((~(0ULL))>>1) using namespace std; const int maxN=1024; const i...
分类:其他好文   时间:2015-03-30 09:26:43    阅读次数:166
1维KD-Tree查找指定范围内的元素
OneKdTree.h #include #include #include using namespace std; class AvlTree; class AvlNode{ friend class AvlTree; int data; int height; AvlNode *left; AvlNode *right; AvlNode(int _data) :da...
分类:其他好文   时间:2015-03-30 09:25:54    阅读次数:219
子序列个数(fzu2129)
子序列个数 Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice FZU 2129 Description 子序列的定义:对于一个序列a=a[1],a[2],......a[n]。则非空序列a'=a[p1],a[p2].......
分类:其他好文   时间:2015-03-30 09:24:54    阅读次数:140
邻接表实现BFS广度优先搜索
#include #include #include #define VERTEX_NUM 8 typedef enum {FALSE = 0, TRUE = 1}BOOL; typedef struct ArcNode { int adjvex; struct ArcNode *nextarc; // struct不能少 }ArcNode; BOOL visi...
分类:其他好文   时间:2015-03-30 09:26:01    阅读次数:201
Strings类的简单使用-代码优雅之道Guava(一)
前言        前边已经对Guava类库做了简单介绍(博文:Java代码优雅之道-Guava(有相关jar包下载)),下面就简单介绍一个Strings工具类的使用,学会灵活使用Strings工具,会使用我们在开发中,更加省时省力,代码健壮性和可读性更高,废话不多说,一看代码就全明了了。 Strings类常用功能和使用 /** * Guava Strings工具类的使用,null和e...
分类:其他好文   时间:2015-03-30 09:25:40    阅读次数:131
两个数值比较大小
两个数值比较大小...
分类:其他好文   时间:2015-03-30 09:26:40    阅读次数:119
[LeetCode 134] Gas Station
题目链接:gas-station /** * There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank and it costs cost[i] of ...
分类:其他好文   时间:2015-03-30 09:25:15    阅读次数:163
POJ_2503_Babelfish(map or 字典树)
Babelfish Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 34816   Accepted: 14908 Description You have just moved from Waterloo to a big city. The people here ...
分类:其他好文   时间:2015-03-30 09:23:04    阅读次数:169
杭电 HDU 1194 Beat the Spread!
Beat the Spread! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5192    Accepted Submission(s): 2705 Problem Description Superbowl Sun...
分类:其他好文   时间:2015-03-30 09:22:36    阅读次数:132
杭电 HDU 1196 Lowest Bit
Lowest Bit Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 9052    Accepted Submission(s): 6656 Problem Description Given an positive i...
分类:其他好文   时间:2015-03-30 09:23:04    阅读次数:125
例题6-8 树 UVa548
1.题目描述:点击打开链接 2.解题思路:本题给出了一颗二叉树的中序遍历和后序遍历,要求找一个叶子,使得它到达根结点的权和最小,如果有多解,那么该叶子自身的权应该尽量小。首先,根据中序遍历和后序遍历建立二叉树,这道题采用数组来存放左右子树的结点值,根为root的左子树结点为lch[root]右子树结点为rch[root]。 那么,如何根据中序遍历,后序遍历来建树呢?方法是根据后序遍历找到根,然...
分类:其他好文   时间:2015-03-30 09:24:43    阅读次数:145
Sicily 1405. Mahershalalhashbaz, Nebuchadnezzar, and Billy Bob Benjamin Go to the Regionals
1405. Mahershalalhashbaz, Nebuchadnezzar, and Billy Bob Benjamin Go to the Regionals Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description The Association for Computing Mac...
分类:其他好文   时间:2015-03-30 09:22:29    阅读次数:151
Sicily 1459. The Dragon of Loowater
1459. The Dragon of Loowater Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem. ...
分类:其他好文   时间:2015-03-30 09:21:28    阅读次数:137
杭电 HDU 1197 Specialized Four-Digit Numbers
Specialized Four-Digit Numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4603    Accepted Submission(s): 3344 Problem Description ...
分类:其他好文   时间:2015-03-30 09:21:39    阅读次数:98
Sicily 1484. 守望者的逃离
1484. 守望者的逃离 Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description    恶魔猎手尤迪安野心勃勃,他背叛了暗夜精灵,率领深藏在海底的娜迦族企图叛变。守望者在与尤迪安的交锋中遭遇了围杀,被困在一个荒芜的大岛上。为了杀死守望者,尤迪安开始对这个荒岛施咒,这座岛很快就会沉下去。到那时,岛上的...
分类:其他好文   时间:2015-03-30 09:21:36    阅读次数:181
Sicily 1234. Playground
1234. Playground Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description George has K <= 20 steel wires shaped in the form of half-circles, with radii a1, a2, . . . , aK. The...
分类:其他好文   时间:2015-03-30 09:21:07    阅读次数:195
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!