码迷,mamicode.com
首页 >  
搜索关键字:std    ( 41627个结果
二分图
将前两天学的二分图写个博文吧。。二分图的概念就不讲了,这里只说算法及要注意的地方PS:有些是在日记上写的,所以不管逻辑啥的,我搬上来了。。匈牙利算法(最大匹配带最小覆盖输出方案):#include #include using namespace std;#define FOR(i,a,n) for...
分类:其他好文   时间:2014-07-12 13:00:10    阅读次数:254
c++11 std::next 与auto 使用
auto定义变量时放在变量前,无需知道具体变量类型,系统可自行推断类型,减少编程工作,特别是在模板使用时,使用更方便。下面简单例子:1 auto a=1;2 auto b='a';3 auto s="abdc";4 auto c;//这样使用时错误的,系统无法自动推断出变量类型5 //下...
分类:编程语言   时间:2014-07-11 21:16:37    阅读次数:323
SGU 134.Centroid(图心)
SGU链接:时间限制:0.25s空间限制:4M题意: 给出一个树(节点数#include #include #include #include #include #define INF 16666using namespace std;struct node { int v, ne;} edge.....
分类:其他好文   时间:2014-07-11 20:28:32    阅读次数:250
Hopcroft-Karp算法模版
#include #include #include #include #include #include using namespace std;const int maxn = 3010;const int INF = 1 G[maxn];int dis;int n, m;bool vis[ma...
分类:其他好文   时间:2014-07-11 20:24:32    阅读次数:256
1到n数组,和为指定数所有序列问题
(1)方法一,背包问题解法 1 #include 2 using namespace std; 3 #include 4 #include 5 6 //采用背包问题方法,从后向前,最后一个放和不放背包里,注意递归退出条件和sum==n后,没有return而是继续 7 vector a; ...
分类:其他好文   时间:2014-07-10 14:32:24    阅读次数:130
华为测试 公共子串计算
题目标题: 计算两个字符串的最大公共字串的长度,字符不区分大小写 输入两个字符串 输出一个整数 案例输入:asdfas werasdfaswer 案例输出:6 #include #include using namespace std; int main() { string str1,str2,temp; int m,MaxNum=0,Len; cin>>str1>>str...
分类:其他好文   时间:2014-07-09 12:16:39    阅读次数:416
Codeforces 444C DZY Loves Colors(线段树)
题目大意:Codeforces 444C DZY Loves Colors 题目大意:两种操作,1是修改区间上l到r上面德值为x,2是询问l到r区间总的修改值。 解题思路:线段树模板题。 #include #include #include #include using namespace std; const int maxn = 5*1e5; typedef long ...
分类:其他好文   时间:2014-07-09 10:28:24    阅读次数:153
最近公共祖先模版
LCA tarjan 的离线算法 #include #include #include using namespace std; const int maxn = 40010; int first[maxn], head[maxn], cnt, sum; struct edge { int u, v, w, next; }e[maxn*2], qe[maxn], Q[maxn]; int...
分类:其他好文   时间:2014-07-09 10:23:35    阅读次数:256
shu_1016 栈
http://202.121.199.212/JudgeOnline/problem.php?cid=1079&pid=2 分析: Catalan数的应用,直接用了Catalan数的递推公式之一 代码: #include #include using namespace std; long long f[20]; void init() { f[0]=f[1]...
分类:其他好文   时间:2014-07-09 10:17:44    阅读次数:239
【足迹C++primer】39、动态内存与智能指针(3)
动态内存与智能指针(3) /** * 功能:动态内存与智能指针 * 时间:2014年7月8日15:33:58 * 作者:cutter_point */ #include #include #include #include using namespace std; /** 智能指针和异常 */ void f() { shared_ptr sp(new int(42)); ...
分类:编程语言   时间:2014-07-09 09:08:04    阅读次数:161
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!