l问题描述:有一块N*N的玉米田(N 2 #include 3 #include 4 5 using namespace std; 6 7 int field[52][52]; 8 int N,K; 9 10 struct Node{11 int x,y,r;12 }node[11];1...
分类:
其他好文 时间:
2014-07-22 22:46:15
阅读次数:
216
我们经常用简单数据类型,比如int作为泛型Dictionary的key,但有时候我们希望自定义数据类型作为Dictionary的key,如何做到? 如果我们想自定义一个struct类型作为key,就必须针对该struct定义一个实现IEqualityComparer接口的比较类,实现该接口的2个方法...
分类:
其他好文 时间:
2014-07-22 22:40:14
阅读次数:
262
拓扑排序。
反向建边。
为了序号小的尽量在前面,我们每次都取出入度为0的最大的点。
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
struct list
{
int u,v,w;
int next;
}edge[110000];
int ...
分类:
其他好文 时间:
2014-07-22 22:38:54
阅读次数:
265
- (NSString*)deviceString{ // 需要#import "sys/utsname.h" struct utsname systemInfo; uname(&systemInfo); NSString *deviceString = [NSString ...
分类:
移动开发 时间:
2014-07-22 22:35:55
阅读次数:
165
避免含糊转换
参数匹配和相互转换
struct B;
struct A
{
A()=default;
A(const B&) //吧B负责给A,拷贝构造函数
{//嘿,这里我有点明白了,只要 后面调用了这个函数,那么这个函数就得有定义
//不能只声明不定义
cout<<"调用了A(const B&)转换!"<<endl;
}...
分类:
编程语言 时间:
2014-07-22 14:43:26
阅读次数:
297
题目:hdoj1754 I Hate It
分析:更新的话,建树的时候保存叶子编号的的节点信息,然后从下往上更新就ok。
求和的话,从根节点开始,然后找在根的左边还是右边,然后递归找一个所有中的最大值即可、
代码:
#include
#include
#include
using namespace std;
const int N = 205000;
struct...
分类:
其他好文 时间:
2014-07-22 14:33:36
阅读次数:
179
线程池的各个线程accept——基于UNP代码1.说明预创建一个线程池,线程池中各个线程accept。主线程不做什么。这是Leader/Follower领导者/跟随者模式2.代码代码基于UNP的库函数#include "unpthread.h"//线程信息typedef struct { pt...
分类:
编程语言 时间:
2014-07-22 00:11:37
阅读次数:
278
Linux C/C++编程时常会遇到“error: expected expression before ‘struct’”错误,此错误一般是由未定义的宏(宏里套宏)或参量引起,导致编译器判断当前语句为非法语句,可能有如下几种情况。1、缺少ioctl.h头文件调用ioctl函数,用到参数VIDIOC...
分类:
其他好文 时间:
2014-07-21 23:30:23
阅读次数:
215
链表是一种在物理存储上非连续,非顺序的存储结构,数据的逻辑关系是通过指针链接次序实现的,链表通过一系列结点组成,结点可以在运行时动态生成。每个结点由两部分组成:数据域和存储下一结点的指针域。链表是一种常见的数据结构。
要想进行链表排序,首先得建立一个单链表,程序代码是由一个数组转化而来,代码如下:
先建立一个结点的结构体:
struct node
{
int val;
node *nex...
分类:
其他好文 时间:
2014-07-21 23:21:43
阅读次数:
339
//1、这一章的习题纯粹为了刷存在感。。。
typedef struct phone
{
char * quhao;
char * jiaohuantai;
char * zhanhaoma;
};
typedef struct call
{
char * date;
char * time;
phone * shiyong;
phone * self;
phone * huji...
分类:
其他好文 时间:
2014-07-21 23:16:53
阅读次数:
177