贪心+优先队列+问题分解对x,y 分开处理当 xl 2 #include 3 #include 4 #include 5 using namespace std; 6 7 struct node { 8 int l,r; 9 int id;10 friend bool...
分类:
其他好文 时间:
2014-07-28 23:42:54
阅读次数:
251
# include
# include
# include
# include
using namespace std;
struct point
{
double left,right;
}p[2010],temp;
bool cmp(point a,point b)
{
return a.left<b.left;
}
int main()
{
int n,i,count,fla...
分类:
其他好文 时间:
2014-07-28 16:20:33
阅读次数:
208
网络编程中经常会涉及到二进制数据传输的问题,在C++中常用的传输方式有文本字符串和结构体封包。如果能将要发送的数据事先放进连续的内存区,然后让send函数获取这片连续内存区的首地址就可以完成数据的发送了,文本字符串如char型数组,以字节为单位,在内存中是顺序存储的,所以可以直接用send函数发送。但是如果要同时发送多个不同类型的数据时,它们在内存中存储的地址是随机的,不是顺序存储的,而且它们之间...
分类:
编程语言 时间:
2014-07-28 16:17:43
阅读次数:
222
考察的是结构体的二次快排
#include
#include
typedef struct Node{
int fir;
int end;
}Node;
Node node[110];
int cmp(const void *a,const void *b)
{
return (*(node *)a).end>(*(node *)b).end?1:-1;
}
i...
分类:
其他好文 时间:
2014-07-28 16:15:23
阅读次数:
218
简单题,当时竟然没有敲出来╮(╯▽╰)╭。。。
方法:每个时间点排序从小到大排序,之后扫一遍即可:是进的时间点就加人,反之出人。更新最大值即可。。。。囧。。。
#include
#include
#include
#include
#include
#include
#include
using namespace std;
struct times
{
bool io;
in...
分类:
其他好文 时间:
2014-07-28 15:58:23
阅读次数:
278
HDU 4884 TIANKENG’s rice shop
题目链接
题意:模拟题,转一篇题意
思路:就模拟即可,注意每次炒完之后就可以接单
代码:
#include
#include
#include
using namespace std;
const int N = 1005;
int T, n, t, k, m;
struct Person {
...
分类:
其他好文 时间:
2014-07-28 15:53:23
阅读次数:
177
第一道Kruskal算法题#include #include #include using namespace std;#define max 505int f[max],maxw;struct edge{ int st,en,w;}ed[max*max/2];int find(int k){ if...
分类:
其他好文 时间:
2014-07-28 15:39:43
阅读次数:
181
由于到达点时不能绕墙,因为这是无意义的,所以,两点间的最小墙依然是按照直线所穿过的墙计算。#include #include #include #include using namespace std;const double eps=0.000000001;struct point{ double...
分类:
其他好文 时间:
2014-07-28 15:11:13
阅读次数:
222
select函数用于在非阻塞中,当一个套接字或一组套接字有信号时通知你,系统提供select函数来实现多路复用输入/输出模型,原型: int select(int maxfd,fd_set *rdset,fd_set *wrset,fd_set *exset,struct timeval *time...
分类:
其他好文 时间:
2014-07-28 15:00:53
阅读次数:
241
代码:#include #define MAX 26 typedef struct TrieNode{ int nCount; struct TrieNode *next[MAX];}TrieNode;TrieNode Memory[1000000];int allocp = 0;TrieNode ...
分类:
其他好文 时间:
2014-07-28 14:42:43
阅读次数:
176