码迷,mamicode.com
首页 >  
搜索关键字:int    ( 143001个结果
【博弈论】【SG函数】bzoj3404 [Usaco2009 Open]Cow Digit Game又见数字游戏
#include#include#include#includeusing namespace std;int m,n;int SG[1000001];int sg(int x){ if(SG[x]!=-1) return SG[x]; if(!x) return SG[x]=0; setS; in...
分类:其他好文   时间:2015-04-14 22:51:37    阅读次数:141
字符串匹配——KMP算法
#include #include const int N = 1000000 + 5;char s[N],t[N];int lens,lent;int next[N];void get_fail() { next[0] = -1; for (int i = 1,j = -1; i < ...
分类:编程语言   时间:2015-04-14 22:49:26    阅读次数:139
poj1523赤裸裸的割点
这题真是没什么好说的。。。赤裸裸的求割点直接模板上 1 #include 2 #include 3 #include 4 #include 5 #define maxn 1100 6 7 using namespace std; 8 9 vector g[maxn];10 int dfn[max.....
分类:其他好文   时间:2015-04-14 22:48:01    阅读次数:156
JAVA语言十个概念
Java十个概念 1、 对象的初始化 (1)非静态对象的初始化 在创建对象时,对象所在类的所有数据成员会首先进行初始化。 基本类型:int型,初始化为0。 如果为对象:这些对象会按顺序初始化。 构造方法的作用就是初始化。 (2)静态对象的初始化 程序中主类的静态变量会在main方法执行前初始化。 不仅第一次创建对象时,类中的所有静态变量都初始化,并且第一次访问某类(注意此时未...
分类:编程语言   时间:2015-04-14 21:43:51    阅读次数:153
C++中动态申请数组
动态申请一维数组 申请使用new,释放使用delete[] 可以通过数组名[下标]和*(数组名+下标)的方式访问数组int main() { int number = 10; int *array = new int[number]; //数组初始化 for (int i = 0; i < number; ++i) { array[i] =...
分类:编程语言   时间:2015-04-14 21:42:34    阅读次数:185
nyoj608 畅通工程 并查集
//发现还是思想最重要 看懂了思想 代码就容易懂了。。#include int fa[1005]; int find(int x) { if(fa[x]!=x) fa[x]=find(fa[x]); return fa[x]; } void comb(int a,int b) { fa[find(fa[a])]=find(fa[b]); } int main() { int n,m,a...
分类:其他好文   时间:2015-04-14 21:37:40    阅读次数:118
UVA1610(贪心)
题意: 给出n个串(n为偶数); 要构造一个串,使n串中有一半小于等于它,另外一半大于它; 要求这个串长度尽量小,同时字典序小; 思路: 把所有串排个序; 然后拿出中间的两个串比较; AC #include #include #include #include #include using namespace std; const int N = 1005;...
分类:其他好文   时间:2015-04-14 21:36:57    阅读次数:131
【USACO】Prime Palindromes(暴力暴力再暴力)
把所有符合条件的数全部记下来,扫一遍就行了,这类数最多2W来个 /* ID: 18906421 LANG: C++ PROG: pprime */ #include #include #include #include using namespace std; const int maxn = 20005; int a,b; int cnt = 0; int prime[maxn]; bool ...
分类:其他好文   时间:2015-04-14 21:34:36    阅读次数:164
C#中的多维数组和交错数组
C#中有多维数组和交错数组,两者有什么区别呢! 直白些,多维数组每一行都是固定的,交错数组的每一行可以有不同的大小。 以二维的举例,二维数组就是m×n的矩阵,m行n列;而交错数组(又叫锯齿数组)有m行,但是每一行不一定是n列。Got it? 还有要注意C#中的数组也是一种类型(C++中不是)! 下面看实例: 二维数组:public static void Main() { int r...
分类:编程语言   时间:2015-04-14 21:34:14    阅读次数:170
堆栈-数组实现
#include #include #define DataType int #define MAX 1024 typedef struct { DataType data[MAX]; int top; }stack, *pstack; pstack ini...
分类:编程语言   时间:2015-04-14 21:32:25    阅读次数:159
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!