08 2019 档案
摘要:题目:https://www.acwing.com/problem/content/143/ 一个字符串的前缀是从第一个字符开始的连续若干个字符,例如”abaab”共有5个前缀,分别是a, ab, aba, abaa, abaab。 我们希望知道一个N位字符串S的前缀是否具有循环节。 换言之,对于每
阅读全文
摘要:题目:https://www.acwing.com/problem/content/833/ 题意:求子串在母串中每次出现时的下标位置。 题解:哈哈哈,敲题时想到之前看到一个人叫 kmp 算法为 看毛片 算法,真是笑死我了hiahiahiahiahia。^ 。 该题的出现位置有点像暴力,跟循环节相关
阅读全文
摘要:题目:https://pintia.cn/problem-sets/994805260223102976/problems/994805287624491008 本题要求编写程序,计算 2 个有理数的和、差、积、商。 输入格式: 输入在一行中按照 a1/b1 a2/b2 的格式给出两个分数形式的有理
阅读全文
摘要:题目:http://codeforces.com/problemset/problem/227/D 题意:n堆个数石子,每堆石子有ai个,通过合并(即将一堆石子移到另一堆石子上),将所有石子合并为一堆,每次合并的代价是这堆石子的个数,在ki的限制下,每堆石子最多只能被合并k次,k次之后就必须移动该堆
阅读全文
摘要:题目:http://codeforces.com/problemset/problem/109/C 题意:一棵树n个节点,组成一个图,每条边都有权值,对于i、j、k三个数,计算所有的 i 到 j 和 i 到 k 的路径上有幸运数的三元组个数。 题解:用并查集来做,对于任意节点 i ,找出与 i 连通
阅读全文
摘要:题目: 给定 N 个实数,计算它们的平均值。但复杂的是有些输入数据可能是非法的。一个“合法”的输入是 [−] 区间内的实数,并且最多精确到小数点后 2 位。当你计算平均值的时候,不能把那些非法的数据算在内。 输入格式: 输入第一行给出正整数 N(≤)。随后一行给出 N 个实数,数字间以一个空格分隔。
阅读全文
摘要:题目: Trouble came from the overseas lands: a three-headed dragon Gorynych arrived. The dragon settled at point C and began to terrorize the residents o
阅读全文
摘要:Problem Description In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several
阅读全文
摘要:题目链接:https://pintia.cn/problem-sets/994805260223102976/problems/994805271455449088 题目: 给定 N 个非 0 的个位数字,用其中任意 2 个数字都可以组合成 1 个 2 位的数字。要求所有可能组合出来的 2 位数字的
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2795 Problem Description At the entrance to the university, there is a huge rectangular billboard of si
阅读全文
摘要:Description Several currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and perf
阅读全文
摘要:题目:Tree Traversals Again An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-n
阅读全文

浙公网安备 33010602011771号