码迷,mamicode.com
首页 >  
搜索关键字:cmp    ( 878个结果
sort exam
1 #include 2 #include 3 #include 4 using namespace std; 5 struct E{ 6 char name[101]; 7 int age; 8 int score; 9 }buf[1000];10 bool cmp...
分类:其他好文   时间:2015-05-05 11:53:48    阅读次数:86
Merge K Sorted Lists
思路:将每个链表的头存在最小堆中,每次取堆首,然后将取出节点的下一个放入堆中中。 1 class cmp{ 2 public: 3 bool operator()(ListNode* l1,ListNode* l2) 4 { 5 return l1->val>l2-...
分类:其他好文   时间:2015-05-05 10:29:37    阅读次数:163
模板 排序
【模板】排序 1 //sort 2 #include 3 bool cmp(const int a,const int b) 4 { 5 return a>b;//降序排列 6 } 7 8 //qsort 9 #include 10 int cmp(const void *x,const ...
分类:编程语言   时间:2015-05-03 10:35:35    阅读次数:116
hdu 2058 The sum problem
数学题目。折腾了一天,这种方法不是最好的,不过按照自己的第一直觉的方法AC还是很开心的。#include#include#include#includeusing namespace std;struct abc{ int start, end;}dt[5000000];bool cmp(co...
分类:其他好文   时间:2015-05-02 19:26:32    阅读次数:178
hdu4221 Greedy?(贪心)
真不知道为啥全是英文题。。。就不能好好的出中文的啊  啊 啊 果然看错了题意   #include #include using namespace std; struct node { long long day,end; }c[100005]; bool cmp(node x,node y) { if(x.end<y.end) return true; if(x.end==y....
分类:其他好文   时间:2015-05-02 16:34:33    阅读次数:121
理解qsort 中的 cmp
百度了很多的资料都没有明白qsort 中 cmp 的用处,用Bing 一搜就搜到一篇自认为比其他都解析清楚的文章直接贴出来算了comparPointer to a function that compares two elements.This function is called repeated...
分类:其他好文   时间:2015-05-01 07:01:56    阅读次数:129
HDU ACM 2111 Saving HDU->贪心
分析:简单贪心题,注意这里给出的已经是单价了,而不是物品的总价值,直接用来排序即可。 #include #include using namespace std; struct A { int p,m; }a[105]; bool cmp(A a1,A a2) { return a1.p<a2.p; } int main() { int v,n,i; int sum; whil...
分类:其他好文   时间:2015-04-30 21:54:50    阅读次数:249
HDU ACM 1069 Monkey and Banana->动态规划
分析:最长子序列的变种;另外长方体可以有三种放法,三种放法都存在同一个数组里面,因为每种长方体可以有无限个。 #include #include using namespace std; struct BOX { int x,y,z; } box[100]; int dp[100]; bool cmp(BOX a,BOX b) { if(a.x>b.x) return true; e...
分类:其他好文   时间:2015-04-30 14:24:20    阅读次数:131
poj 2337 && zoj 1919 欧拉回路+连通性判断
题目要求按字典序排列,而且可能有重边所以一开始就将数组从大到小排列,那么我将字符串加入链表时就会令小的不断前移,大的被挤到后面这里有一点问题就是我一开始使用的是qsort:int cmp(const void *s1 , const void *s2){ return strcmp((char*)s...
分类:其他好文   时间:2015-04-30 12:05:42    阅读次数:125
hdu 1263 水果 sort对结构体中字符串二级排序
#include #include #include using namespace std; struct node { char name[90],place[90]; int num; }c[105]; bool cmp(node x,node y) { if(strcmp(x.place,y.place)<0) return true; if(strcmp(x.place,...
分类:编程语言   时间:2015-04-30 10:39:46    阅读次数:162
878条   上一页 1 ... 60 61 62 63 64 ... 88 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!