码迷,mamicode.com
首页 >  
搜索关键字:namespace    ( 41927个结果
2013山东省赛Rubik’s cube 魔方BFS
二阶魔方,只有0,1 问最少多少步可以转成每个面都为0,或1 BFS即可,对应好旋转时候的关系,因为顺时针转三次和逆时针转1次的效果一样,所以只要6种旋转方式即可,判重可用map省空间,或者直接判省时间 #include "stdio.h" #include "string.h" #include "map" #include "queue" using namespace std;...
分类:其他好文   时间:2015-04-14 12:56:50    阅读次数:126
简单工厂模式
#include using namespace std;class Operation {public: void setOperands(const int operA = 0, const int operB = 0) {m_operandA = operA; m_operandB = ...
分类:其他好文   时间:2015-04-14 12:51:00    阅读次数:126
浅谈C++的virtual 动态绑定。
我们知道C++里 virtual函数可以用来实现多态。继承类可以实现自己的功能来覆盖基类。比如下面这段代码#include#includeusing namespace std;class BaseA{ public: BaseA(string n):name(n){} string g...
分类:编程语言   时间:2015-04-14 12:42:26    阅读次数:153
c++中 extern
用例子给你示范 // 1.cpp int x = 10; // 2.cpp 注意没有包含1.cpp #include using namespace std; extern int x;int main () { cout void print() { std::cout using name...
分类:编程语言   时间:2015-04-14 12:32:06    阅读次数:149
【c++程序】构造函数
#include #include using namespace std; class Person{ string name; bool gender; int age; Person *lover; public: Person(const char *n="无名",bool g=true); void growup(int years); void s...
分类:编程语言   时间:2015-04-14 11:22:46    阅读次数:177
HDU 2222 Keywords Search
ac自动机第一题 代码参考kuangbin,用数组实现 思想参考的这个,写得很详细:http://www.cppblog.com/mythit/archive/2009/04/21/80633.html #include #include #include #include #include using namespace std; #define N 500010 struct trie...
分类:其他好文   时间:2015-04-14 11:20:25    阅读次数:103
POJ 2104 划分树模板题
给出n,m n个数字 m次询问,每次询问(l,r)区间的第k小的数 划分树模板 mark一下 #include "stdio.h" #include "string.h" #include "algorithm" using namespace std; int a[100010],as[100010]; int tree[20][100010];// 记录第i层元素序列 i...
分类:其他好文   时间:2015-04-14 11:19:38    阅读次数:120
QT翻译上下文
QT翻译机制还是比较复杂的,实际翻译调用的是QCoreApplication的translate,如下: translate的参数除了翻译的原文之外,另外还有一个很重要的是context(也就是上下文), 下面来看如下场景的写法,例如我边写了一个类,从QObject派上,而且加上了Q_OBJECT的宏,则演示代码如下: namespace FirstLevel { namespace Sec...
分类:其他好文   时间:2015-04-14 11:14:47    阅读次数:122
POJ 3261 Milk Patterns
刚开始看到最大值要取到1000000,当时就吓尿了,心想难道要改排序算法? 赶紧看了下讨论,发现数据很水,200000就能过了 思路:就是答案二分,然后长度分组,满足条件返回true #include #include using namespace std; #define N 200005 int n,k; int r[N],height[N],sa[N],rank[N]; int wa...
分类:其他好文   时间:2015-04-14 11:12:16    阅读次数:142
有重字符串字典序第k排列
纯模拟规律。。逐步确定每一位。 #include #include #include using namespace std; #define ll long long ll used[17]; ll f[27],ans[38]; ll sum[20]; ll len; char str[21]; ll Jc() { ll s=1,i; ll x[28]; memse...
分类:其他好文   时间:2015-04-14 10:03:51    阅读次数:91
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!