类模板:template struct pair参数:T1是第一个值的数据类型,T2是第二个值的数据类型。功能:pair将一对值组合成一个值,这一对值可以具有不同的数据类型(T1和T2),两个值可以分别用pair的两个公有函数first和second访问。具体用法:1.定义(构造):pair p1....
分类:
编程语言 时间:
2014-07-14 00:41:51
阅读次数:
189
定义一个结构体,有两个成员变量,一个整型的n,一个字符型的c,利用结构体类型声明一个具有5个元素的数组,并随机初始化,根据成员变量n进行从小到大排序,然后输出 冒泡排序然后 在输出结构体#includestruct d{int x;char y;};int main(void){struct d a...
分类:
编程语言 时间:
2014-07-13 23:50:55
阅读次数:
410
STL源码之vector1. SGI的vectorSGI stl vector继承子一个基类:template > class vector : protected _Vector_base在基类中定义了基本的一些操作,并且封装了了vector所需要的基本的三个指针:struct _Vector_....
分类:
其他好文 时间:
2014-07-13 23:19:35
阅读次数:
188
字典树查询
#include
#include
#include
using namespace std;
const int maxn = 30;
typedef struct Trie{
int v;
Trie *next[ maxn ];
}Trie;
Trie root;
void CreateTrie( char *str ){
int len = strlen( st...
分类:
其他好文 时间:
2014-07-13 17:17:39
阅读次数:
336
DOWN操作:linux内核中,对信号量的DOWN操作有如下几种:
void down(struct semaphore *sem); //不可中断
int down_interruptible(struct semaphore *sem);//可中断
int down_killable(struct semaphore *sem);//睡眠的进程可以因为受到致命信号而被唤醒,中断获取信号量...
分类:
其他好文 时间:
2014-07-13 16:21:36
阅读次数:
501
动态链表的建立,输出,删除,插入
#include
#include
#include
#define NULL 0
#define LEN sizeof(struct student)
struct student
{
long num;
float score;
struct student*next;
};
int n;/*n为全...
分类:
其他好文 时间:
2014-07-12 23:23:33
阅读次数:
183
HDU 4565 So Easy!
类似fib的构造
设Fn = x + y*sqrt(b)
啪啦啪啦
#include
#include
#include
#include
#include
using namespace std;
typedef vector vec;
typedef vector mat;
typedef long long ll;
ll a, b,...
分类:
其他好文 时间:
2014-07-12 21:34:01
阅读次数:
349
简单贪心。
将所给数据从小到大进行排序,将所给零件的两数据均小于另一个零件的两数据,看做一个集合。
最后输出集合个数。#include
#include
#include
#include
#include
using namespace std;
struct www
{
int x,y;
}s[5005];
int yy[5005],a,b;
bool cmp(www q,w...
分类:
其他好文 时间:
2014-07-12 19:01:39
阅读次数:
208
引言:
队列的实现除了链表外,也可用数组实现。
分析描述:
队列的结构:
typedef int ElementType;
typedef struct QueueRecord{
int Capacity;
int Front;
int Rear;
int Size;
ElementType *Array;
}QueueRecor...
分类:
其他好文 时间:
2014-07-12 17:50:16
阅读次数:
213
//定义结构
Box.h:
#ifndef BOX_H
#define BOX_H
struct Box{
double length;
double width;
double height;
double volume();
};
#endif
//定义volume方法
t1.cpp:
#include "box.h"
double Box::volume(...
分类:
编程语言 时间:
2014-07-12 17:25:50
阅读次数:
152