BFS。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 #define MAXN 305 8 9 typedef struct node_st {10 int x, y;11 ...
分类:
其他好文 时间:
2014-07-15 23:05:28
阅读次数:
289
1.字节边界对齐 提高读写速度2.构造函数尽量使用初始化列表(不然对象类型会有一次默认构造 初始值)3.尽量使用前置++ ,因为后置++会生成临时对象4.不要用结构体着函数返回值 struct a; a=f(1) ; 会生成临时对象 struct a = f(1); 这样不会生成临时对象5....
分类:
其他好文 时间:
2014-07-15 22:57:36
阅读次数:
313
经验:Traits classes 使得"类型相关信息"在编译期可用。它们以 templates 和 "templates 特化"完成实现
示例:
template
class deque{
public:
class iterator{
public:
typedef random_access_iterator_tag iterator_category;
};
};
//template
template
struct iterator_trai...
分类:
编程语言 时间:
2014-07-15 22:40:20
阅读次数:
372
CCDirector是控制游戏流程的主要组件。 1 typedef enum { 2 /// sets a 2D projection (orthogonal projection)2D投机模式 3 kCCDirectorProjection2D, 4 5...
分类:
其他好文 时间:
2014-07-15 08:12:00
阅读次数:
556
典型的反素数对于任何正整数x,其约数的个数记做g(x).例如g(1)=1,g(6)=4.如果某个正整数x满足:对于任意i(0=t2>=t3>=....#include using namespace std;typedef long long ll;int pri[20]={2,3,5,7,11,1...
分类:
其他好文 时间:
2014-07-14 21:24:55
阅读次数:
221
#includevoid main(){const int count = 5;//定义数量struct student{char name[80];float math,eng;float aver;}stu[count],temp;//输入for (int i = 0; i stu[sub].a...
分类:
编程语言 时间:
2014-07-14 21:23:30
阅读次数:
247
非常简单,就当练个手吧 1 //单链表逆序问题,其实很容易的,就是把指针指向给变一下,注意的几个问题 2 //(1)如果就一个元素,不算头结点,直接返回 3 //(2)注意头结点最后要单独处理问题 4 #include 5 using namespace std; 6 7 typedef str.....
分类:
其他好文 时间:
2014-07-14 16:05:19
阅读次数:
192
typedef的用途:
封装数据类型,方便移植
简化函数指针的定义
结构体:不同类的型元素汇聚。
(1)、在声明类型的同时定义变量:
struct
结构体名{
成员列表
}
变量名列表;
(2)、直接定义结构体类型变量
struct
{
成员列表
}变量名表列;...
分类:
其他好文 时间:
2014-07-14 13:17:18
阅读次数:
240
#include
#include
#include
using namespace std;
#define inf 0x7ffffff
struct Edge
{
int u,v,cost;
}edge[2000];
int pre[200];//父亲
int dis[200];//到源点的距离
int n,m,src;//点的个数,边数,源点
bool relax(int...
分类:
其他好文 时间:
2014-07-14 12:59:28
阅读次数:
265
将线性表以带头结点的单链表作存储结构,偶数放前,奇数放后;代码如下:#includetypedef struct LNode { int data ; struct LNode *next ;}LNode , *LinkList ;int main() { LinkList...
分类:
其他好文 时间:
2014-07-14 10:34:37
阅读次数:
189