码迷,mamicode.com
首页 >  
搜索关键字:cmp    ( 878个结果
[LeetCode]Two Sum 【Vector全局指针的使用】
无序数组返回两个元素和为给定值的下标。 tricks:无序、返回下标增序、返回的是原始数组的下标。 vector*pa; bool cmp(int x,int y){ return (*pa)[x]<(*pa)[y]; } class Solution { public: vector twoSum(vector &a, int t) { int n=a...
分类:其他好文   时间:2014-11-04 22:53:47    阅读次数:173
UVA 1149 Bin Packing
贪心对所有物品排序,然后从大头拿一个,检测如果加上此时最小的是否满足#include #include #include #define maxn 100000+10using namespace std;int a[maxn];int cmp(int a,int b){ return a>...
分类:其他好文   时间:2014-11-04 16:56:46    阅读次数:138
uva-2519 - Radar Installation
反正每一个岛都要有雷达覆盖,放雷达的时候尽可能多覆盖岛...... #include #include #include #include #include using namespace std; struct node { double x,y; }; bool cmp(node a,node b) { return a.x<b.x; } int main() { ...
分类:其他好文   时间:2014-10-26 22:59:46    阅读次数:308
vector,對string排序
這是vector中對string類型排序。 用寫比較函數的方法   #include #include #include #include #include #include using namespace std; //比較函數,升序排序 bool cmp(const string &x,const string &y) //&符號不能少 { return x>y...
分类:编程语言   时间:2014-10-26 10:25:15    阅读次数:195
UVaOJ 112道题目-数据结构
1、110201/10038 Jolly Jumpers (快乐的跳跃者)即从某个数字开始的N个连续数字#include#include#include#include#includeusing namespace std;int arr[3005];bool cmp(int a,int b){ ....
分类:其他好文   时间:2014-10-25 17:09:53    阅读次数:185
P – FULL TANK?
题目大意:给定一张图,和每个点的油价,知道每条路的耗油量,给定一些询问,求从起点到终点用指定油箱容量的车所得到的最小耗费。 解题思路:BFS+优先队列 优先队列介绍:采用stl中的priority_queue实现。priority_queue默认的是最大优先队列,声明时只要priority_queue q就行了。如果是最小堆,麻烦一些 priority_queue,cmp> q。其中cmp函...
分类:其他好文   时间:2014-10-24 14:45:31    阅读次数:205
Python中sort以及sorted函数初探
sorted(...) Help on built-in function sorted in module __builtin__: sorted(...)     sorted(iterable, cmp=None, key=None, reverse=False) --> new sorted list sort(...) Help on built-in function sor...
分类:编程语言   时间:2014-10-24 13:03:18    阅读次数:202
POJ 1287 Networking(最小生成树)
题意  给你n个点 m条边  求最小生成树的权 这是最裸的最小生成树了 #include #include #include using namespace std; const int N = 55, M = 3000; int par[N], n, m, ans; struct edge{int u, v, w;} e[M]; bool cmp(edge a, edge b){return...
分类:Web程序   时间:2014-10-23 10:43:45    阅读次数:229
POJ 1258 Agri-Net(最小生成树 Kruskal)
题意  给你农场的邻接矩阵  求连通所有农场的最小消耗 和上一题一样裸的最小生成树 #include #include #include using namespace std; const int N = 105, M = 10050; int par[N], ans, n, m, t; struct edge { int u, v, w;} e[M]; bool cmp(edge a, ...
分类:Web程序   时间:2014-10-22 11:02:47    阅读次数:203
【转】后缀数组模板
IOI2009论文reference:http://www.cnblogs.com/staginner/archive/2012/02/02/2335600.html 1 int wa[maxn],wb[maxn],wv[maxn],ws[maxn]; 2 int cmp(int *r,int a,...
分类:编程语言   时间:2014-10-21 13:41:17    阅读次数:241
878条   上一页 1 ... 74 75 76 77 78 ... 88 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!