上一页 1 ··· 41 42 43 44 45 46 47 48 49 ··· 58 下一页
摘要: 题目链接: "https://www.luogu.com.cn/problem/P1656" 解题思路: 枚举每一条边,假设这条边被删掉,然后用并查集判断剩下的 $m 1$ 条边能否让这个图连通。 实现代码如下: 阅读全文
posted @ 2020-02-21 09:50 quanjun 阅读(148) 评论(0) 推荐(0)
摘要: 题目链接: "https://www.luogu.com.cn/problem/P1455" 解题思路: 这道题目就是首先用并查集把属于同一个集合的物品合到一起,然后对每一个集合的物品做01背包。 实现代码如下: 阅读全文
posted @ 2020-02-20 22:42 quanjun 阅读(179) 评论(0) 推荐(0)
摘要: Power digit sum $2^{15} = 32768$ and the sum of its digits is $3 + 2 + 7 + 6 + 8 = 26$. What is the sum of the digits of the number $2^{1000}$? 幂的数字和 阅读全文
posted @ 2020-02-18 21:15 quanjun 阅读(281) 评论(0) 推荐(0)
摘要: Lattice paths Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bott 阅读全文
posted @ 2020-02-18 21:07 quanjun 阅读(264) 评论(0) 推荐(1)
摘要: Longest Collatz sequence The following iterative sequence is defined for the set of positive integers: n → n/2 (n is even) n → 3n + 1 (n is odd) Using 阅读全文
posted @ 2020-02-18 20:28 quanjun 阅读(316) 评论(0) 推荐(0)
摘要: Large sum Work out the first ten digits of the sum of the following one hundred 50 digit numbers. 大和 计算出以下一百个50位数的和的前十位数字。 解题思路 目前想到的就是用高精度加法模拟。 100个5 阅读全文
posted @ 2020-02-18 19:20 quanjun 阅读(500) 评论(0) 推荐(0)
摘要: 题目链接: "https://www.luogu.com.cn/problem/P1016" 解题思路(思路全部来自 "hongzy大神的博客" ): 思路: 1. 在起点加满油; 2. 到第i个加油站把油箱里价格 P[i]的油退了,换成价格为P[i]的油。 3. 每次烧油就找最便宜的油烧 实现:单 阅读全文
posted @ 2020-02-18 12:04 quanjun 阅读(241) 评论(0) 推荐(0)
摘要: Highly divisible triangular number The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 阅读全文
posted @ 2020-02-17 19:34 quanjun 阅读(358) 评论(0) 推荐(1)
摘要: Largest product in a grid In the 20×20 grid below, four numbers along a diagonal line have been marked in red. 08 02 22 97 38 15 00 40 00 75 04 05 07 阅读全文
posted @ 2020-02-17 18:49 quanjun 阅读(172) 评论(0) 推荐(0)
摘要: Summation of primes The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. 素数的和 所有小于10的素数的和是2 + 3 + 5 阅读全文
posted @ 2020-02-17 18:34 quanjun 阅读(193) 评论(0) 推荐(0)
上一页 1 ··· 41 42 43 44 45 46 47 48 49 ··· 58 下一页