#include<iostream> #include<cmath> using namespace std; struct Point { double x,y; }; double dis_sq(const Point& a,const Point& b) //距离平方 { return (a. ...
分类:
其他好文 时间:
2017-01-22 23:55:30
阅读次数:
366
它定义了一系列的算法,并将每个算法封装起来,而且使他们还可以相互替换。策略模式让算法的变化不会影响到使用算法的客户。 优点: 1)简化了单元测试,因为每个算法都有自己的类,可以通过自己的接口单独测试。 2)避免程序中使用多重条件转移语句,使系统更灵活,并易于扩展。 3)遵守大部分GRASP原则和常用 ...
分类:
其他好文 时间:
2017-01-21 22:19:46
阅读次数:
210
#include #include using namespace std; struct node{ double num; double price; double weight; }; int cmp(const void *a, const void *b){ node aa = *(nod... ...
分类:
其他好文 时间:
2017-01-21 19:37:16
阅读次数:
324
以计算器程序为例:只需输入运算符号,程序就实例化出合适的对象。通过多态,返回父类的方式实现了计算器的结果。 1)静态工厂方法统一管理对象的创建。 静态工厂方法通过传入的参数判断决定创建哪一个产品的实例,封装了对象的创建,客户端只管消费,实现了对责任(模块)的分割。 2)静态工厂方法推迟了产品的实例化 ...
分类:
其他好文 时间:
2017-01-21 19:34:42
阅读次数:
196
400题留念。 话说这题真是的。。。浪费表情。 算了一下复杂度最好的都要n√nlogn啊。。。这个7w闹哪样。 然而看了一眼题解,按5分。 wtf我还以为有高论啊。 ...
分类:
其他好文 时间:
2017-01-21 18:21:38
阅读次数:
223
<c:forEach>标签用于通用数据循环,它有以下属性 begin和end属性 可以指定开始循环位置和结束循环位置。例如 从集合第二个元素开始迭代: <c:forEach items="${userInfo.roleTypeEnNames}" var="item" varStatus="statu ...
分类:
Web程序 时间:
2017-01-21 09:59:56
阅读次数:
301
#include <iostream> #include <algorithm> #include <cstring> using namespace std; class Data { public: int S, Height; int upl, uph; }; Data Da[100]; in ...
分类:
其他好文 时间:
2017-01-20 23:29:05
阅读次数:
217
1、创建目录cd/srv/salt/packagemkdirhaproxymkdir-phaproxy/filesmkdir-phaproxy/pkg2、编写依赖包模块catpkg/pkg-init.slspkg-init:pkg.installed:-names:-gcc-gcc-c++-glibc-make-autoconf-openssl-openssl-devel-htop-vim-lrzsz3、安装包准备ls-lhaproxy/files-rw-r--r--1r..
分类:
其他好文 时间:
2017-01-20 21:05:36
阅读次数:
245
// [self setValuesForKeysWithDictionary:@{}]; -(void)setValue:(id)value forKey:(NSString *)key{ if([value isEqualToString:@"key"]){ self.nameString=ke... ...
分类:
移动开发 时间:
2017-01-20 16:32:25
阅读次数:
167
#include<bits/stdc++.h>using namespace std;int a[101],b[101],n;int main(){ cin>>n; for (int i=1;i<=n;i++) cin>>a[i]; for (int i=1;i<=n;i++) for (int j ...
分类:
其他好文 时间:
2017-01-19 21:29:27
阅读次数:
225