#define stack_init_size 100
#define stackincrement 10
typedef int ElemType;
typedef int status;
const status error=0;
const status ok=1;
const status overflow=-2;
const int MAXSIZE = 100;
typedef st...
分类:
其他好文 时间:
2014-05-26 06:17:29
阅读次数:
243
const在函数中也有很大的作用。
4.const修饰传入参数。
函数传入参数声明为const,以指明使用这种参数仅仅是为了效率的原因,而不是想让调用函数能够修改该传入参数的值。同理,将对象指针参数或引用参数声明为const,函数将不修改由这个参数所指的对象。
例如:
#include
using namespace std;
//void change(const i...
分类:
编程语言 时间:
2014-05-26 05:52:27
阅读次数:
266
这两天学习了网络流,下面是ISAP算法模板:
const int inf = 0x3fffffff;
template
struct Isap
{
int top;
int d[N], pre[N], cur[N], gap[N];
struct Vertex{
int head;
} V[N];
struct Edge{...
分类:
其他好文 时间:
2014-05-26 04:10:16
阅读次数:
252
简单数论题。区间减法。 1 //Accepted 0 KB 9 ms 2 #include 3
#include 4 using namespace std; 5 const int MAXN = 100005; 6 int f[MAXN]; 7 void
pre() 8 { 9 ...
分类:
其他好文 时间:
2014-05-26 02:54:57
阅读次数:
278
解题思路:求乘法逆元就好了。 1 //Accepted 228 KB 0 ms 2 #include
3 #include 4 const int pp = 9973; 5 int extend_euclid(int a,int b,int &x,int
&y) 6 { 7 ...
分类:
其他好文 时间:
2014-05-26 02:17:41
阅读次数:
210
今天,在看man 9 style时见到了用来处理命令行短形参getopt函数,很是诧异 ——
要知道,我处理命令行参数都是用手动的!于是我如获至宝,赶紧学习学习。getopt的原型被放在unistd.h中,它的原型是这样的:int getopt(int
argc, char * const argv...
分类:
其他好文 时间:
2014-05-26 02:01:30
阅读次数:
252
Format是一个很常用,却又似乎很烦的方法,本人试图对这个方法的帮助进行一些翻译,让它有一个完整的概貌,以供大家查询之用:首先看它的声明:function
Format(const Format: string; const Args: array of const): string; overl...
分类:
其他好文 时间:
2014-05-25 02:04:12
阅读次数:
416
题意:经典八数码问题
思路:HASH+BFS#include
#include
#include
#include
using namespace std;
const int MAXN = 500000;
const int size = 1000003;
typedef int State[9];
char str[30];
int state[9],goal[9]={1, 2, ...
分类:
其他好文 时间:
2014-05-24 21:46:23
阅读次数:
359
题目:http://poj.org/problem?id=2104
划分树待我好好理解下再写个教程吧,觉得网上的内容一般,,,
模板题:
贴代码:
#include
#include
#include
#include
using namespace std;
#define CLR(a) memset(a,0,sizeof(a))
const int MAXN = 100010...
分类:
其他好文 时间:
2014-05-24 18:10:18
阅读次数:
276