码迷,mamicode.com
首页 >  
搜索关键字:std    ( 41627个结果
Vector Demo
/* * vectorDemo.cpp * * Created on: Jul 17, 2014 * Author: lichfeng */#include#include #include #include"vectorDemo.H"using namespace std;void v...
分类:其他好文   时间:2014-07-19 15:39:21    阅读次数:201
Cplus
1,factorials[i] = i * factorials[i - 1];#include using namespace std;const int ArSize = 16;int main() {long long factorials[ArSize];factorials[1] = fa...
分类:其他好文   时间:2014-07-19 15:38:16    阅读次数:202
uva 11181
直接枚举计算就行;#include#include#include#define maxn 22using namespace std;double ans[maxn],p[maxn];bool vis[maxn];int n,r;void dfs(int cur,int cot){ if(c...
分类:其他好文   时间:2014-07-19 15:37:13    阅读次数:158
【练习4.2】使用鼠标事件获取图片像素值
《学习OpenCV》中文版第4章第2题题目要求:点击图片是获取该点的颜色值,并在图像上点击鼠标处用文本将颜色值显示出来。程序代码: 1 #include "stdafx.h" 2 #include 3 #include 4 using namespace std; 5 using namespa.....
分类:其他好文   时间:2014-07-19 15:26:42    阅读次数:242
HDU 4821 (hash)
这道题最重要的不仅是hash这种算法,更要学会利用好STL中的才行。将连续的L个字符经过hash赋值,最后线性判断。其中的判断步骤用到了map的插入特性。#include #include #include #include #include using namespace std;#define ...
分类:其他好文   时间:2014-07-19 15:22:52    阅读次数:167
acm1217教训
能用容器去做的用容器做,尽量少用数组,即使自己明确其数量的上届;#include #include#include//后来我用了一个map容器才能通过,如果自己建立数组就是不过,不知道到底哪里超出了;它明明说的是少于30个,现在做题题意也欺骗人了;using namespace std;const ...
分类:其他好文   时间:2014-07-19 11:15:03    阅读次数:220
线段树(自敲:建树,查找最大值,更新结点值)
HDU1754 1 #include 2 3 using namespace std; 4 5 const int MaxSIZE = 2e6 + 10; 6 7 typedef struct { 8 int Max ; 9 int left, right ...
分类:其他好文   时间:2014-07-19 09:14:48    阅读次数:250
Codeforces Round #FF
A.DZY Loves Hash hash函数 h(x) = x % p 输出第一次冲突的位置#include#include#includeusing namespace std;const int maxn = 4000;int p, n;bool inhash[maxn];int ma...
分类:其他好文   时间:2014-07-19 09:09:32    阅读次数:226
随手写了几行代码
看COM的时候随手写了一行代码,写完发现是工厂方法模式。。。废话不多说了#include "stdafx.h"#include using namespace std;class InterfaceA{public: InterfaceA(); virtual ~Inte...
分类:其他好文   时间:2014-07-19 08:28:32    阅读次数:202
【设计模式】单例模式
所谓单例模式,就是禁止用户代码实例化多个对象实例,保证单例对象的类只有一个实例存在。通过一个函数接口取用这个唯一实例,就能够控制对该实例的访问。下面是一个用C++编写的模拟单例模式的例子。 #include #include using namespace std; class Singleton { public: Singleton() : m_str("Hello wor...
分类:其他好文   时间:2014-07-19 08:17:48    阅读次数:197
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!