码迷,mamicode.com
首页 >  
搜索关键字:cmp    ( 878个结果
Python——functools
该模块为高阶函数提供支持——作用于或返回函数的函数被称为高阶函数。在该模块看来,一切可调用的对象均可视为本模块中所说的“函数”。 目录 一、模块方法 1. functools.cmp_to_key(func) 2.functools.total_ordering(cls) ...
分类:编程语言   时间:2014-12-17 12:37:23    阅读次数:140
poj 1659 Frogs' Neighborhood 度序列可图化 贪心
题意: 对一个无向图给出一个度序列,问他是否可简单图化。 分析: 根据Havel定理,直接贪心即可。 代码: //poj 1659 //sep9 #include #include using namespace std; struct Node{ int num,ids; }p[16]; int ans[16][16]; int n; int cmp(Node a,Node ...
分类:其他好文   时间:2014-12-17 09:07:49    阅读次数:159
自己创建map结构体 sort + cmp
#include #include #include using namespace std; struct Point { int x, y; }; struct Map { Point p; float f; }; bool cmp(Map x, Map y) { return x.f < y.f; } int main() { vector vec; for ...
分类:其他好文   时间:2014-12-17 00:24:19    阅读次数:183
【二分法】【尺取法】bzoj2348 [Baltic 2011]Plagiarism
一开始以为死于精度……调了半天发现死于long long……一、二分法:#include#include#includeusing namespace std;bool cmp(const int &a,const int &b){return a>b;}int n,a[100001],b[1000...
分类:其他好文   时间:2014-12-15 16:53:17    阅读次数:144
DFS/poj 1011/hdu 1455 Sticks
1 #include 2 #include 3 #include 4 using namespace std; 5 int n,tot,ans; 6 bool v[100]; 7 int a[100]; 8 bool cmp(int x,int y) 9 {10 return x>y;11...
分类:其他好文   时间:2014-12-15 10:19:37    阅读次数:192
PHP 使用用户自定义的比较函数对数组中的值进行排序
原文:PHP 使用用户自定义的比较函数对数组中的值进行排序usort(PHP 4, PHP 5)usort — 使用用户自定义的比较函数对数组中的值进行排序 说明 bool usort ( array &$array , callable $cmp_function ) 本函数将用用户自...
分类:编程语言   时间:2014-12-13 10:45:21    阅读次数:304
Python比较函数__cmp__
#!/usr/bin/pythonclass my_type(object): def __init__(self, v): self.value = v def __cmp__(self, v2): if self.value > v2.value: ...
分类:编程语言   时间:2014-12-12 23:28:00    阅读次数:191
贪心/hdu 2037 今年暑假不AC
1 #include 2 #include 3 #include 4 using namespace std; 5 struct node 6 { 7 int st; 8 int ed; 9 };10 node a[110];11 int n,ans;12 bool cmp(nod...
分类:其他好文   时间:2014-12-11 23:56:33    阅读次数:179
贪心/hdu 1051 Wooden Sticks
#include#include#includeusing namespace std;struct node{ int l,w; bool v;};int n;node a[5010];bool cmp(node x,node y){ if (x.l==y.l) return x...
分类:其他好文   时间:2014-12-11 23:43:26    阅读次数:246
贪心/hdu 1052 Tian Ji -- The Horse Racing
1 #include 2 #include 3 #include 4 using namespace std; 5 int n; 6 int tian[1010],king[1010]; 7 bool cmp(int x,int y) 8 { 9 return x>y;10 }11 int...
分类:其他好文   时间:2014-12-11 23:41:12    阅读次数:146
878条   上一页 1 ... 71 72 73 74 75 ... 88 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!