转自python中list总结 一、list可以看做是一个数据结构,也是一个class, 用help(list)可以看见其方法,元素的增删改查都有各种现成的方法, 二、list操作包含以下函数:1、cmp(list1, list2):比较两个列表的元素 2、len(list):列表元素个数 3、ma ...
分类:
编程语言 时间:
2017-08-02 13:17:08
阅读次数:
173
1 //只需要按照结束时间排序贪心即可 2 #include 3 #include 4 using namespace std; 5 typedef struct 6 { 7 int x,y; 8 }P; 9 P p[10005]; 10 bool cmp(P a,P b) 11 { 12 if(a... ...
分类:
其他好文 时间:
2017-07-29 18:57:56
阅读次数:
167
1 //简单的贪心。 2 #include 3 #include 4 #include 5 using namespace std; 6 double r[605],s; 7 bool cmp(double x,double y) 8 { 9 return x > y; 10 } 11 bool a... ...
分类:
其他好文 时间:
2017-07-29 16:46:36
阅读次数:
84
#include <iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> using namespace std; int cmp(int a,int b) { return a>b; } i ...
分类:
其他好文 时间:
2017-07-29 13:03:53
阅读次数:
153
其实这道题的思路挺简单的,就是找在第一位置没有出现过并且权值小的那个字母为0. 把a~z按照权值排序,其实难就难在这里,权值很大我们怎么给他排序。 其实可以开个数组来存他们每位数是多少,然后给他们比个大小就好了。 后面排好序就从25开始依次递减 bool cmp(int a, int b) { fo... ...
分类:
其他好文 时间:
2017-07-26 14:43:21
阅读次数:
137
1 #include 2 #include 3 using namespace std; 4 bool cmp(int x,int y) 5 { 6 return x0) 20 {c[0]=m[n-1]; 21 printf("1 %d\n",a[0]); 22 printf("1 %d\n",c[... ...
分类:
其他好文 时间:
2017-07-25 22:35:22
阅读次数:
210
1 #include 2 #include 3 #include 4 #define N 110 5 #define M 5000 6 using namespace std; 7 8 int n, m, u[M], v[M], w[M], r[M], p[N]; 9 bool cmp(int i,... ...
分类:
其他好文 时间:
2017-07-23 21:00:58
阅读次数:
120
Python 解释器内置了一些函数,它们总是可用的。这里将它们按字母表顺序列出。 all(iterable) 如果iterable的所有元素为真(或者iterable为空), 返回True。 如果iterable的所有元素为真(或者iterable为空), 返回True。等同于: def all(i ...
分类:
编程语言 时间:
2017-07-23 18:04:48
阅读次数:
156
#include using namespace std; typedef struct { char *name; int stuid; int age; }Student; /**************************/ bool cmp(const Student &stua,con... ...
分类:
其他好文 时间:
2017-07-22 23:45:32
阅读次数:
205
结构体node定义:呐...因为不是Treap,所以就不必定义优先级yx了; 这次为了代码简短,总算是把判断子树方向函数(cmp)和节点信息维护函数(maintain)封在了结构体里。 旋转函数rotate:与Treap相比,没有任何变化,就是写得简短了一些。 插入函数insert:Treap时需要 ...
分类:
其他好文 时间:
2017-07-21 01:32:51
阅读次数:
256