#ifndef SWAP_H_INCLUDED#define
SWAP_H_INCLUDED#include using namespace std;struct Job{ string name; int
salary;};template void Swap(T &a, T &b);...
分类:
其他好文 时间:
2014-05-16 01:14:38
阅读次数:
340
这篇文章决定对最近一个单机版Web程序用到的东西总结一下。一、反射Linq之OrderBy
动态Linq结合反射对某字段排序:namespace 动态Linq{ class Program { static void Main(string[]
args) ...
分类:
其他好文 时间:
2014-05-16 00:40:13
阅读次数:
414
原理都很简单,关键是某些边界能否正确写对:
#include
#include
using namespace std;
class Node {
public:
int val;
Node* next;
Node(int val = 0):val(val),next(NULL){
}
};
Node* quicksort(Node* head, Node* tai...
分类:
其他好文 时间:
2014-05-15 20:27:36
阅读次数:
296
线段树维护的是区间有多少个空位置,每次查询第X个空位置在哪,sum[rt]>=X就向左区间找,sum[rt]
#include
#include
#include
using namespace std;
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
const int maxn = 55555;
int...
分类:
其他好文 时间:
2014-05-15 20:19:48
阅读次数:
256
和上一题一样,寻找第K个位置,只不过需要处理一下下一个位置在哪,画图看看就知道了。
#include
#include
#include
using namespace std;
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
const int maxn = 30000+5;
int sum[maxn<<...
分类:
其他好文 时间:
2014-05-15 20:07:28
阅读次数:
262
partial_sort接受一个middle迭代器,使序列中的middle-first个最小元素以递增顺序排序,置于[first, middle)内。下面是测试代码:
#include
#include
#include
using namespace std;
int main()
{
int a[] = {10,9,8,7,6,5,4,3,2,1,0};
vec...
分类:
其他好文 时间:
2014-05-15 19:23:27
阅读次数:
361
在这里实现了带头结点的链表,包含插入,删除,查询,清空链表一系列功能#includeusing
namespace std;class LinkList{ char *elem; LinkList *next; static int
length;public: LinkList(char *e) ...
分类:
其他好文 时间:
2014-05-15 18:05:31
阅读次数:
271
派生类不能直接访问基类的私有成员,若要访问必须使用基类的接口,即通过其成员函数。实现方法有如下两种:1.在基类的声明中增加保护成员,将基类中提供给派生类访问的私有成员定义为保护成员。2.将需要访问基类私有成员的派生类成员函数声明为友元。#includeusing
namespace std;clas...
分类:
其他好文 时间:
2014-05-15 17:44:44
阅读次数:
234
太水了, 我都不忍心发题解, 但毕竟是sgu上一道题,
我试试能不能一直这么写下去,就是求phi,上代码#include #include #include #include #include #include
#define N 10010using namespace std;int get.....
分类:
其他好文 时间:
2014-05-15 17:25:24
阅读次数:
306
using System;using
System.Collections.Generic;using System.Linq;using System.Text;using
System.Data;using System.Reflection;namespace TestConsole{ ...
分类:
其他好文 时间:
2014-05-15 17:07:04
阅读次数:
187