摘要: 题目:http://codeforces.com/problemset/problem/227/D 题意:n堆个数石子,每堆石子有ai个,通过合并(即将一堆石子移到另一堆石子上),将所有石子合并为一堆,每次合并的代价是这堆石子的个数,在ki的限制下,每堆石子最多只能被合并k次,k次之后就必须移动该堆 阅读全文
posted @ 2019-08-26 17:50 hbhdhd 阅读(232) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/problemset/problem/109/C 题意:一棵树n个节点,组成一个图,每条边都有权值,对于i、j、k三个数,计算所有的 i 到 j 和 i 到 k 的路径上有幸运数的三元组个数。 题解:用并查集来做,对于任意节点 i ,找出与 i 连通 阅读全文
posted @ 2019-08-25 22:20 hbhdhd 阅读(334) 评论(0) 推荐(0) 编辑
摘要: 题目: 给定 N 个实数,计算它们的平均值。但复杂的是有些输入数据可能是非法的。一个“合法”的输入是 [−] 区间内的实数,并且最多精确到小数点后 2 位。当你计算平均值的时候,不能把那些非法的数据算在内。 输入格式: 输入第一行给出正整数 N(≤)。随后一行给出 N 个实数,数字间以一个空格分隔。 阅读全文
posted @ 2019-08-19 21:47 hbhdhd 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 题目: 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 阅读全文
posted @ 2019-08-19 16:12 hbhdhd 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2019-08-19 10:40 hbhdhd 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://pintia.cn/problem-sets/994805260223102976/problems/994805271455449088 题目: 给定 N 个非 0 的个位数字,用其中任意 2 个数字都可以组合成 1 个 2 位的数字。要求所有可能组合出来的 2 位数字的 阅读全文
posted @ 2019-08-17 22:04 hbhdhd 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 题目链接: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 阅读全文
posted @ 2019-08-17 15:48 hbhdhd 阅读(135) 评论(0) 推荐(0) 编辑
摘要: Description Several currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and perf 阅读全文
posted @ 2019-08-04 13:21 hbhdhd 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 题目: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 阅读全文
posted @ 2019-08-01 19:29 hbhdhd 阅读(147) 评论(0) 推荐(0) 编辑
摘要: Problem Description Jack likes to travel around the world, but he doesn’t like to wait. Now, he is traveling in the Undirected Kingdom. There are n ci 阅读全文
posted @ 2019-07-16 14:15 hbhdhd 阅读(127) 评论(0) 推荐(0) 编辑