码迷,mamicode.com
首页 >  
搜索关键字:std    ( 41627个结果
九度 1339
#include #include #include #include using namespace std; #ifdef ONLINE_JUDGE #define FINPUT(file) 0 #define FOUTPUT(file) 0 #else ...
分类:其他好文   时间:2014-05-15 06:27:05    阅读次数:230
第七章 快速排序
快速排序最坏情况下时间复杂度是O(n*n),但是它平均时间复杂度是O(N*logn),并且常数因子很小,可实现就地排序,所以被作为内排序的常用排序方法. #include using namespace std; void swap(int &i,int &j) { int temp=i; i=j; j=temp; } int partition(int *vector...
分类:其他好文   时间:2014-05-15 06:05:35    阅读次数:254
备忘之 拷贝构造函数
//拷贝构造函数,什么时候算是 “合适的时候”,才会合成呢~~~ #include using namespace std; class A { public:     A(char *_str):str(_str),x(0){}     //A(const A&a){cout     //如果没有定义的话,对于类A来说,编译器依然不会合成,因为此时的对象之间的...
分类:其他好文   时间:2014-05-15 05:11:13    阅读次数:334
hdu how many prime numbers 筛选法求素数
/* * hdu How many prime numbers * date 2014/5/13 * state AC */ #include #include #include using namespace std; bool isPrime(int x) { int sqr=sqrt(x*1.0); for(int i=2;i<=sqr;i++) {...
分类:其他好文   时间:2014-05-15 05:07:18    阅读次数:261
遵照std::allocator实现自定制的内存分配器
下面是标准库STL中allocator的实现 template class allocator : public _Allocator_base { // generic allocator for objects of class _Ty public: typedef allocator other; typedef _Allocator_base _Mybase; t...
分类:其他好文   时间:2014-05-15 05:05:57    阅读次数:385
12周 项目2 老师兼干部类
#include #include using namespace std; class Teacher { public: Teacher(string nam,int ag,char s,string ad,int num,string t) { name=nam; age=ag; sex=s; ...
分类:其他好文   时间:2014-05-15 04:32:56    阅读次数:262
UVa 10308 Roads in the North 树的直径
题目来源:UVa 10308 Roads in the North 题意:求距离最远的2点之间的距离 思路:裸的树的直径 或者树形DP #include #include #include using namespace std; const int maxn = 100010; struct node { int to, w; node(){} node(int to, int...
分类:其他好文   时间:2014-05-15 03:37:18    阅读次数:295
HDU--2846--Repository--字典树
#include #include #include #include #include #include using namespace std; struct ssss { ssss *c[26]; int n,v; }*s; void insert(char *str,int v) { int i,j,k,l; ssss *p,*q; p=...
分类:其他好文   时间:2014-05-14 15:06:54    阅读次数:357
hdu 最小公倍数
/* * hdu 最小公倍数 * date 2014/5/13 * state AC */ #include using namespace std; int gcd(int x,int y) { while(x!=y) { if(x>y)x=x-y; else y=y-x; } return x; } int main() ...
分类:其他好文   时间:2014-05-14 14:29:59    阅读次数:225
c++ Fraction类 操作符重载练习
#include using namespace std;int GreatestCommonDivisor(int m,int n) //辗转相除法求最大公约数{ int r; do { r = m % n; m = n; ...
分类:编程语言   时间:2014-05-14 11:18:00    阅读次数:675
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!