#include#includeusing namespace std;bool HARSH[10066]; //实际上申请来之后初试都是falsebool cmp(int a,int b){ return a>b;}int main(){ fill(HARSH,HARSH+1066,...
分类:
其他好文 时间:
2015-03-03 13:31:23
阅读次数:
171
#include#includeusing namespace std;struct Student{ char name[15]; char ID[15]; int gread;}STU[66666];bool cmp(Student a,Student b){ return a.grea...
分类:
其他好文 时间:
2015-03-02 12:55:55
阅读次数:
179
#include#include#includeusing namespace std;struct Person{ char name[10]; int age,money;}P[100010];bool cmp(Person a,Person b){ if(a.money!=b.money...
分类:
其他好文 时间:
2015-03-01 23:44:05
阅读次数:
186
#include#includeusing namespace std;struct cake{ double amount; double sum_price,price;}M[1010];bool cmp(cake a,cake b){ return a.price>b.price;}in...
分类:
其他好文 时间:
2015-02-27 20:06:39
阅读次数:
148
上一题中用到了二分查找,而二分查找的前提条件就是原数据有序,故需要先进行排序。考虑用stl 中的sort函数对数据进行排序;由于不是基本数据类型而是自定义结构体不能自动排序,就需要给出排序规则。方法有两种:1.写 cmp函数bool cmp(stu a,stu b){return strcmp(a....
分类:
编程语言 时间:
2015-02-22 21:50:36
阅读次数:
250
本题算是贪心中的基础题。
#include
#include
#include
#include
using namespace std;
const int N=102;
struct time
{
int s,e;
}data[N];
int n;
bool cmp(time a,time b)
{
if(a.e==b.e)
return a.s<b....
分类:
其他好文 时间:
2015-02-21 10:54:35
阅读次数:
122
#include#include#include#includeusing namespace std;typedef struct STU{ char mname[15]; char mID[15]; int mscore;}STU;bool cmp(STU a,STU b) ...
分类:
其他好文 时间:
2015-02-18 11:46:53
阅读次数:
146
Python内置函数sorted可以对可迭代对象进行排序,其中有cmp和key两个参数,这两个参数对排序的效率有很大的影响。...
分类:
编程语言 时间:
2015-02-17 00:48:35
阅读次数:
243
先按长度排序,先先插入长的,在插入的时候同时进行查询。#include
#include
#include
#include
using namespace std;
typedef struct
{
char str[12];
}P;
P p[200000];
bool cmp(P p1,P p2)
{
if(strlen(p1.str)>strlen(p2.str))
...
分类:
其他好文 时间:
2015-02-16 22:12:31
阅读次数:
184
int V; //顶点数量vector G[max_v]; //图的邻接表表示方法vector rG[max_v]; //把边反向建的图vector vs; //后序遍历顺序的顶点列表bool used[max_v]; //访问标记int cmp[max_v]; ...
分类:
其他好文 时间:
2015-02-14 17:28:57
阅读次数:
188