上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 58 下一页
摘要: kmp算法是解决单模匹配问题的算法,难点在于求next[]数组 求next[]数组:对于子串的所有前缀子串的最长公共前后缀的长度,就是next[]数组的值 首先,要了解两个概念:"前缀"和"后缀"。 "前缀"指除了最后一个字符以外,一个字符串的全部头部组合;"后缀"指除了第一个字符以外,一个字符串的 阅读全文
posted @ 2019-10-16 21:25 知道了呀~ 阅读(1405) 评论(2) 推荐(1) 编辑
摘要: A. Optimal Currency Exchange time limit per test 1.5 seconds memory limit per test 512 megabytes input standard input output standard output Andrew wa 阅读全文
posted @ 2019-10-10 20:10 知道了呀~ 阅读(351) 评论(0) 推荐(0) 编辑
摘要: D2. Equalizing by Division (hard version) time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard outpu 阅读全文
posted @ 2019-10-09 21:35 知道了呀~ 阅读(335) 评论(0) 推荐(0) 编辑
摘要: C. Book Reading time limit per test 1 second time limit per test memory limit per test 256 megabytes memory limit per test input standard input input 阅读全文
posted @ 2019-09-27 17:33 知道了呀~ 阅读(459) 评论(0) 推荐(0) 编辑
摘要: CF1209C Paint the Digits 题意:给定T组数据,每组数据第一行输入数字串长度,第二行输入数字串,用数字1和2对数字串进行涂色,被1涂色的数字子串和被2涂色的数字子串拼接成新的数字串,要求新的数字串是非递减的。 题解:对原数字串进行排序,然后从后往前和从前往后各涂一次,若涂不完则 阅读全文
posted @ 2019-09-25 21:06 知道了呀~ 阅读(260) 评论(0) 推荐(0) 编辑
摘要: D. Cow and Snacks 题意:有n种小吃,m个人,每个人有两种喜欢的小吃,当一个人遇到两种自己都喜欢的小吃,可以都吃掉,问在最优的吃小吃顺序下,不能吃到自己喜欢的小吃的人数最少是多少? 题解:把n种小吃当作n个点,m个人当作m条边,每个连通图里面第一个吃的人,一定是可以吃两种自己喜欢的小 阅读全文
posted @ 2019-09-25 20:59 知道了呀~ 阅读(403) 评论(0) 推荐(0) 编辑
摘要: D. Restore Permutation 题意:给定n个数a[i],a[ i ]表示在【b[1],b[i-1]】这些数中比 b[i]小的数的和,要你构造这样的b[i]序列 题解:利用树状数组 求比b[i]小的数的和,在从大到小二分枚举最大的一个数x,使得左边小于x的所有数的和小于等于a[i],v 阅读全文
posted @ 2019-09-24 21:16 知道了呀~ 阅读(220) 评论(0) 推荐(0) 编辑
摘要: C. Magic Grid time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Let us define a magic grid 阅读全文
posted @ 2019-09-23 21:40 知道了呀~ 阅读(423) 评论(0) 推荐(0) 编辑
摘要: B. Uniqueness time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output B. Uniqueness time limit p 阅读全文
posted @ 2019-09-23 20:53 知道了呀~ 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 以下转载自:https://www.cnblogs.com/wkfvawl/p/9445376.html 1.前言 首先我们要明白树状数组是一种数据结构,利用树状数组可以以空间换取时间,这一点和之前的线段树一样,但是树状数组访问会更快,效率更高,树状数组不同于线段数的一点就是这棵树的构成。 二叉树或 阅读全文
posted @ 2019-09-23 16:57 知道了呀~ 阅读(263) 评论(0) 推荐(0) 编辑
上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 58 下一页