随笔分类 - 做题报告(2023+)
摘要:Cut Ribbon 基本思路 一眼完全背包,然而样例全过却无法AC。 看了提示之后明白这是一个要求必须完全装满的完全背包。 意思就是纸带剪完的剩余也得是要求的长度。 我一开始的想法是打标记,所有非要求长度的都标记成负数,然后要求长度的F数组设为1。 for (int i = 0; i <= 501
阅读全文
摘要:P4141 消失之物 基本思路 做\(n\)次计数背包。 当然\(TLE\). #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int N
阅读全文
摘要:P1156 垃圾陷阱 基本思路 受这题的影响,我总觉得这题不应该直接把时间当作状态方程的值,于是搞了\(F[i][j]\),为前\(i\)个物品,前\(j\)时间内能到达的最大高度,然后又搞一个数组维护最优时间,但我的能力根本行不通。 #include<iostream> #include<algo
阅读全文
摘要:P2370 yyy2015c01 的 U 盘 基础思路 看到题目要求最小需要的最大接口。自然认为既然答案要求接口,那状态方程的值就是接口。 一开始状态方程F[i][j],\(i\)为前\(i\)个接口,\(j\)为当前体积。而F[i][j]则为当前最小的最大接口值 状态转移方程F[i][j] = m
阅读全文
摘要:P1734 最大约数和 基本思路 设状态方程F[i][j]为前\(i\)个数和为\(j\)时的最大约数和。 状态转移则是F[i][j] = max(F[i - 1][j], F[i - 1][j - i] + divisorSum(i) 即要么选\(i\),要么不选。 代码实现 WA一个点,TLE六
阅读全文
摘要:P1466 USACO2.2 集合 Subset Sums 毫无思路 如果不告诉我这题是DP题,我一定会爆搜。 看了题解,很妙。 居然也能套背包板子。 定义F[i][j]为在前\(i\)个数中选择一些数其和为\(j\)的方案总数。 显然转移方程F[i][j] = F[i - 1][j] + F[i
阅读全文
摘要:P2347 NOIP1996 提高组 砝码称重 最初思路 看出来是多重背包,但是第一次用于求方案数,一开始想的是累加。但是实现起来发现结果很抽象,想想也不是那么回事。比如从样例上来说,F[3] = 1,F[2] = 1,F[1] = 1,显然F[3] != F[1] + F[2] 改进思路 然后受到
阅读全文
摘要:P1802 5 倍经验日 基本思路 还是零一板子,只是在枚举小于当前所需药水量时需要考虑输家的加分。 #include <iostream> #include <cstdio> #include <cstring> using namespace std; int n, x; int F[9000]
阅读全文
摘要:P1510 精卫填海 最初思路 状态方程F[i],i是体积,F[i]指能填平该体积的最小体力。 推出转移方程F[i] = min(F[i], F[i-v[i]] + m[i]) 但是代码实现只有10pts #include <iostream> #include <cstdio> #include
阅读全文
摘要:P1833 樱花(有疑惑) 最逆天的一集 一开始打算用最初的二维数组dp做,一直80tps,T一个点,WA一个点。 #include <iostream> #include <cstdio> #include <cstring> using namespace std; string a, b; i
阅读全文
摘要:P1853 投资的最大效益 思路 就是一道完全背包板子题,不过是要操作n次然后每次更新背包容量。 但是TLE一个点 #include<iostream> #include<algorithm> #include<cstdio> #include<cstring> using namespace st
阅读全文
摘要:P1825 Corn Maze S 无脑深搜,然后卡死在了37pts。 #include<iostream> #include<algorithm> #include<cstdio> using namespace std; struct coord { int x, y; }; int walk[
阅读全文
摘要:P1162 填涂颜色 大概思路,暴搜所有\(0\)点,搜到就填色,然后搜色块的时候一旦碰边就打标记,回溯之后看标记决定标\(0\)还是标\(2\)。 思路是理论可行,但是代码容易出问题。 一开始\(48pts\)的代码 #include<iostream> #include<algorithm> #
阅读全文
摘要:P2895 [USACO08FEB] Meteor Shower S 语言问题引发的惨案 题目本身不难,简单的BFS,但是写出来明明思路感觉没有问题,却不是答案错就是爆队列。 #include <iostream> #include <algorithm> #include <cstdio> #in
阅读全文
摘要:P1182 数列分段 Section II 再一次对位单杀18年的我 \(2018\) \(0pts\) #include<cctype> #include<cstdio> #include<algorithm> using std::sort; int n,a[100010],QZ_sum[100
阅读全文
摘要:一开始贪心思路不对且根本没考虑重复,无脑sort后直接排组玄学了70pts。 #include <iostream> #include <algorithm> using namespace std; int n; int cnt, ans = 0x7fffffff; int a[100010];
阅读全文
摘要:P1106删数问题 对2018年的我一次完美的对位单杀 2018 44pts Code #include<cstdio> #include<iostream> #include<algorithm> using std::cin; using std::cout; using std::sort;
阅读全文
摘要:昨天晚上看了题目没思路。 早上上课回来之后想着就直接根据题目搞一个左脑一个右脑,然后两边分别加时间取最大暴搜,结果T了九个,这是代码。 #include <iostream> using namespace std; int tAns, ans; int s[5], array[30]; bool
阅读全文
摘要:对比例的计算在整形中的应用不熟练。 要算A:B = X : Y; 最好的方法不是 B = A * (Y/X); 而是 B = A * Y / X;
阅读全文
摘要:康复训练的第一道搜索 调了一个小时,这是原来的代码 #include <iostream> #include <cstring> using namespace std; int n; int ans[500][11], count; void dfs(int step, int sum) { if
阅读全文

浙公网安备 33010602011771号