P1120 Small Wooden SticksA deep dive into solving the classic backtracking problem of reconstructing equal-length sticks from broken pieces, with pruning techniques and optimization strategies.2024-05-30题解
P1120 小木棍读题 P1120 小木棍 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 给 $n$ 个小木棍的长度 $a_i$ ,满足$1 \leq a_{i} \leq 50$ , $n \leq 650$ ,它们之间可以任意拼接,现在要让它们拼接后的长度相同,求这个相同长度的最小值。 例如: 1 2 9 5 2 1 5 2 1 5 2 1 其中最小的长度是6,分别由3个 5 1 和一个2 2 2拼成。 题目说是搜索题。 思路 这题看起来简洁易懂,但是实际操作起来却比较繁琐,我最早不信邪,使用贪心来尝试,结果不行,还是只能老老实实去写搜索。 首先分析一下题目中隐藏的数2024-05-30题解
P1434 [SHOI2002] Skiing: A Classic Dynamic Programming ChallengeMichael loves skiing, but to gain speed, he must always ski from a higher point to a lower one. Given a grid of mountain heights, find the length of the longest downhill path he can take by moving up, down, left, or right. This classic problem is a perfect introduction to memoized dynamic programming.2024-05-28题解
P1434 [SHOI2002] 滑雪读题 P1434 [SHOI2002] 滑雪 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 给定一个含有海拔高度的矩形,算出从高到低“滑雪”的最大长度。 “滑雪”只能从一个格子滑到上下左右相邻,且海拔严格小于当前海拔的格子。 例如: 1 2 3 4 5 1 2 3 4 5 16 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9 这里的最大路径是: 共25格。 注意,“长度”为首尾经过总的格子的个数,比如路径$1\rightarrow 2$的长度为22024-05-28题解
P1535 [USACO08MAR] Cow Travelling SExplore the classic USACO problem 'Cow Travelling'—a dynamic programming approach to counting paths with exact time constraints on a grid, complete with optimized solutions and edge-case insights.2024-05-26题解
P1535 [USACO08MAR] Cow Travelling S读题 P1535 [USACO08MAR] Cow Travelling S - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 题目大概意思是说,奶牛在一个给定大小的矩形范围内走,地块有两种:草地或者树,其中树奶牛不能走。 奶牛一次可以上下左右走,不能原地不动(但是可以绕圈!),给定两个点A,B,求出奶牛从A到B的步数为T的路径总数。 这里原题表述有些问题,不知道是不是翻译的不清楚,原文说的是“在 T 秒内”,但是实际上就看的是T秒这一秒。害得我半天没找出毛病,还是看讨论版才发现的 思路 最早想的是用BFS来搜索,直到队首元素的时间到t+1位置。但是试了一下就报MLE了2024-05-26题解
I've Seen Others Write Problem Solutions, So I'm Starting TooWell, That’s It The problem list I plan to work through is this one on Luogu. I won’t necessarily go through it in order, and I won’t force myself to hit a daily or weekly quota. The idea is simply: trying to explain a problem clearly to someone else is a great way to learn. It also leaves somethin2024-05-25题解
看到一些人开始在博客上写题解,我也准备开始。嗯,就这样 准备刷的题单是luogu上的这个,不一定按顺序刷,也不一定强制自己每天/每周要写多少吧,只是想:尝试向别人解释清楚一个问题,是一种很好的学习。 同时也能留下点什么。 嗯,就这样。2024-05-25题解