union有两个作用:1,节约空间,如果一个struct存在两个互斥的变量,则可以把这个struct变成union2,将同一个内存作为多种解释代码: 1 #include 2 using namespace std; 3 4 //作用1,如果只是存a,20000000 个s_tag节约20M空间.....
分类:
其他好文 时间:
2014-08-18 21:54:52
阅读次数:
267
这是一个最短路径的裸题,我们在边结构体中 添加成员路径和花费,然后在松弛操作的时候用这两个来松弛就OK
// AC 840k 109ms
#include
#include
using namespace std;
#define MAX 1001
#define IFN 1<<30-1
struct node
{
int to,len,cost,next;
}edge[MAX*100...
分类:
其他好文 时间:
2014-08-18 20:33:12
阅读次数:
155
冒泡排序算法是思路最简单、最直接的排序方法之一。每遍历一遍,则将最大(或者最小)的一个数冒泡出来。预先定义的排序类型。由于只是为了验证排序方法是否正确,所以此处只是简单的对10个元素进行排序检测。如下所示:#define MAXSIZE 10typedef struct { int r[MAXSI....
分类:
其他好文 时间:
2014-08-18 20:27:32
阅读次数:
210
/*先吐槽下,刚开始没看懂题,以为只能是一个连通图0T0
题意:给你一个有向图,求G图中从v可达的所有点w,也都可以达到v,这样的v称为sink.求这样的v.
解;求强连通+缩点。求所有出度为0的点即为要求的点。
注意:可能有多个联通分支。
*/
#include
#include
#include
#define N 5100
struct node {
int u,v,w,next;...
分类:
其他好文 时间:
2014-08-18 18:36:42
阅读次数:
225
【GBK】0G's fans( me ) 13:34:26typedef struct _TX_DATA{ int len; unsigned char buff[0x100];} TX_DATA, *PTX_DATA;typedef struct _RX_DATA{ int len; unsign...
分类:
其他好文 时间:
2014-08-18 16:16:52
阅读次数:
275
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
* Sort a linked list in O(n log n) time using const...
分类:
其他好文 时间:
2014-08-18 14:31:02
阅读次数:
191
??
1.C++中的结构体
#include
struct
lstruct
{
int
num;
};
struct
MyStruct
{
int
num;
double
db = 10.8;//可以有默认的值
//MyStruct sx;//拒绝内部定义自己,也...
分类:
编程语言 时间:
2014-08-18 13:08:44
阅读次数:
329
/*
刚开始想错了,我以为必须是相邻的点才能连接,原来无线距离可以任意连接
*/
#include
#include
#include
#include
#define N 600
struct node {
int u,v;
}f[N];
struct nodee{
int u,v;
double w;
}ff[N*N];
double distance(int i,int j) {...
分类:
其他好文 时间:
2014-08-18 12:34:54
阅读次数:
154
5.8.State Types5.8.1.Introduction5.8.2.Service and Host Check Retries5.8.3.Soft States5.8.4.Hard States5.8.5.Example5.8.1.IntroductionThe current stat...
分类:
其他好文 时间:
2014-08-18 12:03:34
阅读次数:
279
前几天写类linux文件系统的时候,被这个搞死了,今天终于弄懂了
这是cpp文件
#include
#include
#include
#include
using namespace std;
char ch[250];
struct s{
short a, b;
};
int main(){
FILE *file = fo...
分类:
其他好文 时间:
2014-08-18 10:53:04
阅读次数:
395