码迷,mamicode.com
首页 >  
搜索关键字:std    ( 41627个结果
hdu4858 项目管理 bestcoder round1 B
唔。。弱弱的暴力水果 0操作时,将v加到u上,可以直接把v加到u相连的点上,这样输出时直接输出要求点的值。 布这样的话反正我是超时了。。 #include #include #include #include #include #include #include const int maxn=100010; using namespace std; vector e[maxn]...
分类:其他好文   时间:2014-07-22 00:31:39    阅读次数:204
hoj Counting the algorithms
贪心加树状数组 给出的数据可能出现两种情况,包含与不包含,但我们从右向左删就能避免这个问题; #include #include #include using namespace std; const int maxn=200010; int f[maxn],l[maxn],a[maxn]; long long tree[maxn]; int n; inline int lowbit(int ...
分类:其他好文   时间:2014-07-22 00:27:36    阅读次数:210
HDU 2594 Simpsons’ Hidden Talents
经典扩展kmp。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 void getA (char *T,int *A){ 7 int j=0; 8 int len=strlen (T); 9 wh...
分类:其他好文   时间:2014-07-21 14:34:49    阅读次数:204
最小的K个数
从有N个数的数组中需找最小的K个数。方法一:O(nlog(n))排序后的前K个数。方法二:O(n)1. 需要2k个额外的临时变量。 1 #include 2 #include 3 4 using namespace std; 5 6 const int len = 1000; 7 int n...
分类:其他好文   时间:2014-07-21 14:34:25    阅读次数:143
HDU 1686 Oulipo
kmp 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int ans; 7 char n[1000010],m[10010]; 8 int next[10010]; 9 10 void getn...
分类:其他好文   时间:2014-07-21 14:15:53    阅读次数:170
uva 201 - Squares(自己的方法,同学有更好一点点的方法)
#include #include #include #include #include using namespace std; int h[20][20]; int v[20][20]; int size_[20]; int n,m; int flag; void judge(int x,int y)//这是关键部分的代码,用来判读那是否能构成square; { int a1=n-x...
分类:其他好文   时间:2014-07-21 13:36:09    阅读次数:221
C++primer读书笔记9转换与类类型
有时候指定了自己类类型来表示某种类型数据如SmallInt,那么为了方便计算就会指定一个转换操作符,将该类类型在某种情况下自动的转换为指定的类型 转换操作符 operator type(); 转换函数必须是类成员函数,不能指定返回类型,并且形参列表必须为空,并且通常不应该改变转换对象,所以操作符通常定义为const成员。 #include using namespace std; cla...
分类:编程语言   时间:2014-07-21 13:32:27    阅读次数:181
LeetCode_39combinationSum2 [Combination Sum II]
#pragma warning(disable:4996) #include <Windows.h> #include <tchar.h> #include <cstdio> #include <vector> using namespace std; /* submit time : 3 1. Runtime Error Last executed input: [5,3]...
分类:其他好文   时间:2014-07-21 13:26:03    阅读次数:250
uva 815 - Flooded!(点名要做的思路题~我觉得方法挺好)
#include #include #include #include using namespace std; double a[100000]; double vol[100000]; int m,n; double v1,v2; bool cmp(double aa,double bb) { if(aa>bb) return true; } int main() { int...
分类:其他好文   时间:2014-07-21 11:43:45    阅读次数:226
STL_稀疏图,树_使用vector邻接表存储
本文出自:http://blog.csdn.net/svitter 分析:vector是STL模板中的容器。可以利用其性质来构建邻接表。 定义: #include #define MAXN 10000 //max n of a tree or graph //if is a tree, n / 2 is OK ; using namespace std; typedef ve...
分类:其他好文   时间:2014-07-21 11:27:55    阅读次数:228
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!