python列表排序简单记一下python中List的sort方法(或者sorted内建函数)的用法。关键字:python列表排序 python字典排序 sortedList的元素可以是各种东西,字符串,字典,自己定义的类等。sorted函数用法如下:Python代码sorted(data,cmp=...
分类:
编程语言 时间:
2014-08-29 10:37:57
阅读次数:
240
注意!这不是单纯的字典序排序,比如90、9,应该是990最大对字符串排序蛋疼了好久,因为别人说string很慢,所以一直没有用过。看别人用string还是比较方便的,学习一下对了,这里的cmp函数写的还是很简洁的,比我写的要好得多 1 #define LOCAL 2 #include 3 #inc....
分类:
其他好文 时间:
2014-08-28 12:53:09
阅读次数:
225
#include
#include
#include
#include
#include
using namespace std;
bool vis[1000];
double x[1000],y[1000];
int n;
int cnt;
struct node{
int u,v;
double dis;
}edge[500000];
int cmp(node a,node...
分类:
其他好文 时间:
2014-08-27 22:01:48
阅读次数:
257
题意:找最短的木棍能够组成的长度,
hdoj 1518 的加强版
代码:
#include
#include
#include
using std::sort;
#define M 70
int s[M], vis[M];
int n, ans;
int cmp(int a, int b)
{
return a > b;
}
int dfs(int cou, int cur, ...
分类:
其他好文 时间:
2014-08-27 09:28:37
阅读次数:
158
8.24
函数
要调用一个函数,需要知道函数的名称和参数,比如求绝对值的函数abs,只有一个参数。可以直接从Python的官方网站查看文档:
http://docs.python.org/2/library/functions.html#abs
也可以在交互式命令行通过help(abs)查看abs函数的帮助信息。
比较函数cmp(x, y)就需要两个参数,如果x,返回-1,如果x...
分类:
编程语言 时间:
2014-08-24 18:08:02
阅读次数:
283
#include #include #include using namespace std;#define maxn 100100int wa[maxn],wb[maxn],wv[maxn],ws[maxn];int r[maxn],sa[maxn];char str[maxn];int cmp(...
分类:
其他好文 时间:
2014-08-23 16:35:51
阅读次数:
261
"[]"的用法在"常见问题"已经有所说明,引用如下:1、push dword ptr [024c1100] 压栈024c1100值的双字 2、cmp eax,[ebp+14] eax-ebp+14的有效值,不保留值,主要看标志位 3、cmp byte ptr [eax],46 字节型ea...
分类:
编程语言 时间:
2014-08-21 18:37:44
阅读次数:
266
题意:。。。
这道题就是区间问题三种中的区间完全覆盖问题,不懂的可以看我上一篇也是区间完全覆盖。
直接上代码:
#include
#include
#include
using std::sort;
struct node{
double le, ri;
}s[1005];
int cmp(node a, node b)
{
return a.le < b.le;
}
int ma...
分类:
其他好文 时间:
2014-08-20 00:02:06
阅读次数:
297
题目输出最长公共字串#define maxn 200010int wa[maxn],wb[maxn],wv[maxn],ws[maxn];int cmp(int *r,int a,int b,int l){return r[a]==r[b]&&r[a+l]==r[b+l];}//yuan lai z...
分类:
其他好文 时间:
2014-08-19 09:18:33
阅读次数:
250
HDU 4957 Poor Mitsui
题目链接
思路:利用辗转相除法去贪心即可,注意容积为0的情况,这是个坑点
代码:
#include
#include
#include
using namespace std;
const int N = 45;
struct SB {
int a, b;
} sb[N];
bool cmp(SB x, SB y...
分类:
其他好文 时间:
2014-08-17 22:49:02
阅读次数:
227