上一页 1 2 3 4 5 6 7 8 9 10 ··· 42 下一页
摘要: 简单的模拟题。暴力枚举 1 /* 2 模拟 3 */ 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 #include11 #include12 #include13 #include14 using namespace std;15 typedef long long int64;16 //typedef __int64 int64;17 typedef pair PII;18 #define MP(a,b) make_pair((a),(b)) 19 const int inf = 0x3f3f3f3f 阅读全文
posted @ 2013-09-14 18:26 xxx0624 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 简单的字符串处理题。要注意细节!附数据两组:ABCCabcaeAAAabcAAAAabcAaBaCa 1 /* 2 3 */ 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 #include11 #include12 #include13 #include14 using namespace std;15 typedef long long int64;16 //typedef __int64 int64;17 typedef pair PII;18 #define MP(a,b) make_pair((. 阅读全文
posted @ 2013-09-08 19:21 xxx0624 阅读(179) 评论(0) 推荐(0) 编辑
摘要: Dinic+maxflow题意:找这样一种边的个数,就是增加该边的容量,可以使得最大流变大思路:求maxflow,再枚举流量为0的边,增加容量,看是否能找到增广路径。 1 /* 2 Dinic+maxflow 3 题意:找这样一种边的个数,就是增加该边的容量,可以使得最大流变大 4 思路:求maxflow,再枚举流量为0的边,增加容量,看是否能找到增广路径。 5 */ 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 #include 14 #include 1... 阅读全文
posted @ 2013-09-07 15:17 xxx0624 阅读(349) 评论(0) 推荐(0) 编辑
摘要: 费马小定理题意:求s1+s2+s3+...+sn;si表示n划分i个数的n的划分的个数,如n=4,则s1=1,s2=3 利用隔板定理可知,就是求(2^n-1)%mod-----Y 现在已知 (2^mod-1)%mod = 1,所以 Y = 2^( (n%(mod-1) -1 +mod)%mod )%mod 证明( 定理:a^(p-1)==1%p,gcd(a,p)==1 ): (http://www.cnitblog.com/luckydmz/archive/2008/06/03/39458.html) 构造模p的完全剩余系P = {0,1, 2, … ,p-1}, 因为gcd(a, p) = 阅读全文
posted @ 2013-09-07 10:46 xxx0624 阅读(512) 评论(0) 推荐(0) 编辑
摘要: dfs: 1 /* 2 dfs 3 */ 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 #include11 #include12 #include13 #include14 using namespace std;15 typedef long long int64;16 //typedef __int64 int64;17 typedef pair PII;18 #define MP(a,b) make_pair((a),(b)) 19 const int maxn = 1005;20 const i 阅读全文
posted @ 2013-09-06 01:11 xxx0624 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 简单的线段树。记录MinVal 和 相应的ID即可 1 /* 2 线段树 3 */ 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 #include 14 using namespace std; 15 typedef long long int64; 16 //typedef __int64 int64; 17 typedef pair PII; 18 #define MP(a,b) make_pair((a),(... 阅读全文
posted @ 2013-09-05 20:20 xxx0624 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 题意:给定一篇文章和一些句子。询问句子是否在文章中出现。kmp模板题 1 /* 2 kmp 3 */ 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include10 #include11 #include12 #include13 #include14 using namespace std;15 typedef long long int64;16 //typedef __int64 int64;17 typedef pair PII;18 #define MP(a,b) make_pair((a),(b)) 19 co 阅读全文
posted @ 2013-09-05 09:38 xxx0624 阅读(219) 评论(0) 推荐(0) 编辑
摘要: A题:水题。。 1 #include 2 #include 3 const int maxn = 1005; 4 char s[ maxn ]; 5 int main(){ 6 //freopen("in.txt","r",stdin); 7 while( scanf("%s",s)!=EOF ){ 8 int len = strlen(s); 9 int c1 = 0,c2 = 0,c3 = 0;10 for( int i=0;i 2 const int maxn = 100005; 3 typedef long long LL.. 阅读全文
posted @ 2013-08-28 23:46 xxx0624 阅读(312) 评论(0) 推荐(0) 编辑
摘要: ac自动机 模板题 1 /* 2 3 */ 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 #include 14 using namespace std; 15 typedef long long int64; 16 //typedef __int64 int64; 17 typedef pair PII; 18 #define MP(a,b) make_pair((a),(b)) 19 const int m... 阅读全文
posted @ 2013-08-25 22:46 xxx0624 阅读(312) 评论(0) 推荐(0) 编辑
摘要: 模拟一遍即可。注意一些特殊情况,见代码。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 const int maxn = 10005; 9 10 struct Ploy{ 11 int cnt;//项的数目 12 int coe[ maxn ];//各项系数 13 int exp[ maxn ];//各项指数 14 }a; 15 struct Ploy2{ 16 int coe1,coe2; 17 int exp1,... 阅读全文
posted @ 2013-08-24 20:23 xxx0624 阅读(294) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 42 下一页