Trie树,第一次写,简单的建树+搜索它的思路hiho上讲得很清楚,good~ 1 #include 2 #include 3 using namespace std; 4 char word[11]; 5 int n,m; 6 struct trie 7 { 8 int num; 9 ...
分类:
其他好文 时间:
2014-07-19 21:17:39
阅读次数:
205
1链表逆序http://blog.csdn.net/niuer09/article/details/5961004typedef struct tagListNode{ int data; struct tagListNode* next;}ListNode, *List;List Re...
分类:
其他好文 时间:
2014-07-19 20:28:12
阅读次数:
188
枚举两点,然后同步BFS,看代码吧,很容易懂的。代码:#include #include #include #include #include #include #include #define Mod 1000000007using namespace std;struct Point{ i...
分类:
其他好文 时间:
2014-07-19 20:21:38
阅读次数:
245
今天在工作时,看到了奇葩的结构体初始化方式,于是我查了一下C99标准文档和gcc的说明文档,终于搞清楚是怎么回事了。 假设有如下结构体定义:typedef struct{ int a, b, c;} MyStruct; 那么结构体的初始化方式如下有三种:(1) C89的初始化方式MyS...
分类:
编程语言 时间:
2014-07-19 20:09:36
阅读次数:
203
#include #include using namespace std;typedef struct Node{ Node* lchild; Node* rchild; int data;}BNode,BTree;void visit(Node*);void inorder(B...
分类:
其他好文 时间:
2014-07-19 19:26:40
阅读次数:
226
file/filetype.c #include "apue.h"intmain(int argc, char *argv[]){ int i; struct stat buf; char *ptr; for (i = 1; i < argc; i++) { printf("%s: ", argv[...
分类:
其他好文 时间:
2014-07-18 23:38:27
阅读次数:
412
A.hstruct A{ int a; int b;}; B.cpp在B.cpp里面用到这个结构体有两种方法1.自己定义一个一模一样的结构体struct A{};2.包含A.h头文件 第一种感觉有点蛋疼同样的结构体定义两次,是不是重复了第二种包含别人的头文件,会带来编译的小麻烦,而且这样...
分类:
编程语言 时间:
2014-07-18 23:23:26
阅读次数:
263
NAME
stat 获取文件属性
这个函数位于头文件中
函数原型:
int stat(const char *path, struct stat *buf);
参数:
path 文件路径+文件名
buf 指向buffer的指针
返回值:
-1 遇到错误
0 成功返回
函数作用:
把path文件的信息复制到指针buf所指的结构体中。...
分类:
系统相关 时间:
2014-07-18 21:36:18
阅读次数:
263
这题要用BFS去做,要注意的是’x‘,这里可以有优先队列去做,会很简单;另一个要注意的是,a只有一个,r可能有很多个,所以可以用a去找最接近的r;#include #include #include "string.h"using namespace std;struct step{ int x,y...
分类:
其他好文 时间:
2014-07-17 18:13:36
阅读次数:
180
struct
结构体是由基本数据类型构成、并用一个标识符来命名的各种变量的组合
格式
struct 结构名 {
类型 变量名;
类型 变量名;
......
}结构变量;
结构名是结构的标识符
结构 typedef
给结构体起别名
结构数组...
分类:
其他好文 时间:
2014-07-17 10:15:07
阅读次数:
244