上一页 1 ··· 3 4 5 6 7 8 9 10 11 下一页
摘要: 只要求sa 1 #include<algorithm> 2 #include<cstdlib> 3 #include<cstring> 4 #include<cstdio> 5 #include<cmath> 6 using namespace std; 7 8 #define N 200010 9 阅读全文
posted @ 2016-04-08 21:28 Yangjiyuan 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 后缀数组模板题 阅读全文
posted @ 2016-04-08 21:23 Yangjiyuan 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 用个分隔符将两个字符串连接起来,再用后缀数组求出height数组的值,找出一个height值最大并且i与i-1的sa值分别在两串字符中就好 阅读全文
posted @ 2016-04-08 16:15 Yangjiyuan 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 第K大也就是第n-K+1小,所以就可以的二分答案了 (江哥讲过一道类似题) 二分答案找出比当前答案小的数的位置的坐标,判断一下是否可以选出满足不在同一行同一列的n-K+1个数,然后就可以跑匈牙利了,对于一个坐标(x,y)如果满足a[x][y]≤a[x][y]当前答案,就把第x行向第y列连边,然后跑匈 阅读全文
posted @ 2016-04-07 21:54 Yangjiyuan 阅读(382) 评论(0) 推荐(0) 编辑
摘要: 1.randomDescription 给定4个参数A0,N,c,p,你需要按下式构造A1~AN: A[i]=(A[i-1]2+c)mod p 之后,你需要求出A1~AN中,第K大的数值。Input 一行五个正整数A0,N,c,p,K。Output 一行一个整数,描述答案。Sample Input 阅读全文
posted @ 2016-04-06 22:31 Yangjiyuan 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 可以算出合并多少次。 1 #include<algorithm> 2 #include<iostream> 3 #include<cstdlib> 4 #include<cstring> 5 #include<cstdio> 6 #include<cmath> 7 using namespace s 阅读全文
posted @ 2016-04-06 20:09 Yangjiyuan 阅读(290) 评论(0) 推荐(0) 编辑
摘要: 距离一个点最远的点一定是直径的一个端点。考虑运用这个原理,每次维护一下直径端点即可。 阅读全文
posted @ 2016-04-06 20:06 Yangjiyuan 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 1 toad1.1 题目描述 有 n 个石子, A B 两人博弈, A 先手。 A 首先取若干个石子(至少一个,不能取完),然后B和A 再轮流取石子,每次取的石子不能超过 axb ( x 表示上次取的石子数, a, b 是两个正整数参数),且至少取一个,无法操作的人输。求 n 满足什么条件时先手必胜 阅读全文
posted @ 2016-04-05 22:12 Yangjiyuan 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 1 xlk1.1 题目描述 给定一棵大小为 n 的无根树,求满足以下条件的四元组 (a, b, c, d) 的个数: 1. 1 ≤ a < b ≤ n 2. 1 ≤ c < d ≤ n 3. 不存在一个点,使得这个点同时在点 a 到点 b 的最短路和点 c 到点 d 的最短路上。1.2 输入格式 第 阅读全文
posted @ 2016-04-05 22:02 Yangjiyuan 阅读(311) 评论(0) 推荐(0) 编辑
摘要: Description 设P(n)为从(0,0)移动到点(n,0)的不同路径数目,移动的方式有以下三种:(x,y)->(x+1,y-1),(x,y)->(x+1,y),(x+y)->(x+1,y+1),并且路径不能和第四象限有交集。求P(n),并对10^9+7取模。 Input 第一行一个整数T,表 阅读全文
posted @ 2016-04-03 20:51 Yangjiyuan 阅读(258) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 下一页