码迷,mamicode.com
首页 >  
搜索关键字:namespace    ( 41927个结果
解释器模式
【1】什么是解释器模式?解释器模式:【2】解释器模式代码示例:代码示例: 1 #include 2 #include 3 #include 4 using namespace std; 5 6 class Context; 7 8 class AbstractExpression 9 {1...
分类:其他好文   时间:2014-09-04 23:37:10    阅读次数:253
访问者模式
【1】什么是访问者模式?访问者模式:【2】访问者模式代码示例:代码示例1: 1 #include 2 #include 3 #include 4 using namespace std; 5 6 class Person 7 { 8 public: 9 string action;...
分类:其他好文   时间:2014-09-04 23:36:20    阅读次数:206
hdu1754 线段树
1 //Accepted 7172 KB 515 ms 2 //基础线段树 3 #include 4 #include 5 #include 6 using namespace std; 7 const int imax_n = 200005; 8 struct ...
分类:其他好文   时间:2014-09-04 23:34:30    阅读次数:269
usaco-2.3-prefix-pass
这个题目要想办法用DP方法来解决:dp[i]=max(dp[i],dp[j]+j-i./*ID: qq104801LANG: C++TASK: prefix*/#include #include #include #include #include #include using namespace ...
分类:其他好文   时间:2014-09-04 23:31:10    阅读次数:375
求旋转有序数组的最小值和在旋转数组中查找
#include using namespace std; int find2(int A[],int n) { int high=n-1; int low =0; int mid; while(A[high]<=A[low]) { if(high-low==1) { mid=high; break; } ...
分类:其他好文   时间:2014-09-04 22:18:50    阅读次数:216
享元模式
【1】什么是享元模式?享元模式:【2】享元模式的代码示例:代码示例1: 1 #include 2 #include 3 #include 4 using namespace std; 5 6 class Flyweight 7 { 8 public: 9 virtual void o...
分类:其他好文   时间:2014-09-04 22:10:00    阅读次数:254
中介者模式
【1】什么是中介者模式?中介者模式:【2】中介者模式代码示例:代码示例: 1 #include 2 #include 3 using namespace std; 4 5 class Mediator; 6 class ConcreteColleague1; 7 class ConcreteCo.....
分类:其他好文   时间:2014-09-04 22:08:20    阅读次数:264
将成员函数用作可调用对象
19.18编写一个函数,使用count_if统计在给定的vector中有多少个空string。#include#include#include#include#includeusing namespace std;int main(){ vector svec={"fhhd","fdf",""...
分类:其他好文   时间:2014-09-04 22:07:30    阅读次数:250
uva 10125 - Sumsets(a+b+c=d)
希望下次能马上想到 a+b 、d-c 分开来算。然后保存其中一项的值,算出另一项来就查找该值是否存在。 这种方法明显比三重循环省时。 还有下面的方法: 三重循环穷举a,b,d;然后二分穷举c; #include #include #include using namespace std; int a[1010],i,j,k,ans,f,n; int comp(int x,...
分类:其他好文   时间:2014-09-04 20:58:40    阅读次数:203
旋转卡壳解poj3608Bridge Across Islands
继续上一次的旋转卡壳的问题,这次是求两个凸包的最短距离, 其实选择卡壳就是只要找到"当前向量面积不小于下一个向量面积"即可, 满足这个条件,当前的两个ymin和ymax点就是一对对踵点了。 代码如下,欢迎参考: #include #include #include using namespace std; typedef struct{float x,y;} Dot; Dot operat...
分类:其他好文   时间:2014-09-04 20:57:40    阅读次数:397
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!