预备知识: 1. sort 使用时得注明:using namespace std; 或直接打 std::sort() 还得加上 #include 2. qort是qsort的升级版,如果能用sort尽量用sort,使用也比较简单,不像qsort还得自己去写 cmp 函数, 只要注明 ...
分类:
其他好文 时间:
2014-07-16 21:18:57
阅读次数:
217
当你循环输入的时候我们有几种方法
一:while(scanf("%d %d",&a,&b)!=EOF)//>0//==1
反正有很多种,但是今天早上我用两个代码提交发现了问题
相同的算法但是第一个超时
#include
#include
#define max 1000000+10
#include
using namespace std;
int a[max];
int cmp(int...
分类:
其他好文 时间:
2014-07-14 16:46:36
阅读次数:
201
最近在做项目出现了下面的问题W/ActivityManager(300): Permission Denial: starting Intent { cmp=com.android.settings/.MovieViewProxySet } from ProcessRecord{4057a828 1...
分类:
移动开发 时间:
2014-07-13 23:47:50
阅读次数:
299
简单贪心。
将所给数据从小到大进行排序,将所给零件的两数据均小于另一个零件的两数据,看做一个集合。
最后输出集合个数。#include
#include
#include
#include
#include
using namespace std;
struct www
{
int x,y;
}s[5005];
int yy[5005],a,b;
bool cmp(www q,w...
分类:
其他好文 时间:
2014-07-12 19:01:39
阅读次数:
208
头文件:
#include
using namespace std;
1.默认的sort函数是按升序排序。
sort(a,a+n); //两个参数分别为待排序数组的首地址和尾地址
2.可以自己写一个cmp函数,按特定意图进行排序。
例如 :
1).对数组a降序排序
int cmp( const int &a, const int &b ){...
分类:
其他好文 时间:
2014-07-08 20:11:02
阅读次数:
172
艰难的写上一篇,小学期太累了,,,很难坚持刷
#include
#include
#include
#include
#include
#include
using namespace std;
int m,n;
int num;
struct Grid
{
int x,y;
}grid[5555];
int cmp(const void* a,const void* b)
{
...
分类:
其他好文 时间:
2014-07-03 18:39:34
阅读次数:
267
VS关于hash_map使用的一些常用构造方法汇总,包括基本类型和结构体,相信够一般模仿使用:
# include
#include
#include
struct order
{
char orderNO[20];
char name[10];
int NO;
char type;
};
typedef order Order;
struct cmp{
enum
{...
分类:
其他好文 时间:
2014-07-03 15:39:22
阅读次数:
254
http://acm.hdu.edu.cn/showproblem.php?pid=1280普通方法(625ms)#include #include #include int b[3000*1501];int cmp(const void *a,const void *b){ return *...
分类:
其他好文 时间:
2014-07-01 21:55:11
阅读次数:
185
莫队算法?感觉没什么优越性啊?难道就是因为在排序的时候cmp函数的不同?这样做为什么减少时限啊?我带着疑惑敲了代码,却一直有bug……代码: 1 type node=record 2 l,r,id,x,y:int64; 3 end; 4 var a,ans:array[1..55...
分类:
其他好文 时间:
2014-06-28 16:50:06
阅读次数:
248
对一个数组,将数组中偶数从大到小排序,奇数从小到大排序,奇数和偶数交叉着放且输出数组第一位放奇数,若奇数和偶数不等长,则把剩下的直接放到数组中。#include#include#includeusing namespace std; bool cmp(int &a,int &b){ return ....
分类:
其他好文 时间:
2014-06-28 09:37:42
阅读次数:
127