上一页 1 ··· 49 50 51 52 53 54 55 56 57 ··· 65 下一页
摘要: 原题链接 题解,请看题解区 ————能不能利用已经算过的值来减少后续计算量呢? 如果你too long on line 2:n为一的时候只输出零 code #include<bits/stdc++.h> using namespace std; int a[5005]={0}; int f[5005 阅读全文
posted @ 2024-02-17 15:15 纯粹的 阅读(134) 评论(0) 推荐(0)
摘要: 原题链接 太妙了,请移步题解区,有用数学归纳法做的,也有用找规律做的 L型积木一定是成对出现的 code #include<bits/stdc++.h> using namespace std; const int mod=1e9+7; long long dp[10000005]={0}; int 阅读全文
posted @ 2024-02-17 14:26 纯粹的 阅读(147) 评论(0) 推荐(0)
摘要: 原题链接 题解请移步题解区,相当详细 code #include<bits/stdc++.h> using namespace std; #define ll long long inline void read(ll &x) { x = 0; ll flag = 1; char c = getch 阅读全文
posted @ 2024-02-17 01:11 纯粹的 阅读(16) 评论(0) 推荐(0)
摘要: 原题链接 题解 细节颇多看代码 code #include<bits/stdc++.h> using namespace std; struct unit { int s,e; }milk[5005]; bool cmp(unit a,unit b) { return a.s<b.s; } int 阅读全文
posted @ 2024-02-16 17:33 纯粹的 阅读(30) 评论(0) 推荐(0)
摘要: 原题链接 题解1:单调栈+并查集? 单调栈特性:栈内元素大小和序号由栈底到栈顶具有单调性,本题大小单调减,序号单调增 维护:新元素入栈时,栈内剩余的所有小于该元素的元素出栈,并视新元素为集合首领,然后新元素入栈 查询:查询集合首领即可 code1 #define ll long long #incl 阅读全文
posted @ 2024-02-16 15:00 纯粹的 阅读(12) 评论(0) 推荐(0)
摘要: 原题链接 题解 code #include<bits/stdc++.h> using namespace std; int fa[1005]; int finds(int now) { return fa[now]=(now==fa[now]?now:finds(fa[now])); } vecto 阅读全文
posted @ 2024-02-16 02:31 纯粹的 阅读(12) 评论(0) 推荐(0)
摘要: 原题链接 题解 1.对于没有固定颜色的节点来说,每个节点只会有三种颜色,而这又是一棵树,树形dp由此而来 2.由相邻节点不同确定转移方程 3.即使有求模也可能要开long long code #include<bits/stdc++.h> using namespace std; #define l 阅读全文
posted @ 2024-02-15 22:13 纯粹的 阅读(56) 评论(0) 推荐(0)
摘要: 原题链接 思路 并查集 然后看看是否存在上表面联通的洞与下表面联通的洞位于同一集合 code #include<bits/stdc++.h> using namespace std; double n,h,r; int fa[1005]; vector<int> up,down; struct { 阅读全文
posted @ 2024-02-15 21:12 纯粹的 阅读(31) 评论(0) 推荐(0)
摘要: 原题链接 题解 1.总共有t秒,每一秒不是上升就是下降 2.要在救援队赶来之前把体力全部花光 code #include<bits/stdc++.h> using namespace std; int dp[3005][1505]={0};//代表第i秒使用j点体力的方案数 int main() { 阅读全文
posted @ 2024-02-15 20:02 纯粹的 阅读(23) 评论(0) 推荐(0)
摘要: 原题链接 题解 存在某种问问题顺序使得答案最小,可是我们不知道排序的规律,遂试探 给定一种排序,交换任意相邻同学问问题顺序,对答案的改变如下: code #include<bits/stdc++.h> using namespace std; struct unit { int s,a,e,sum; 阅读全文
posted @ 2024-02-15 19:09 纯粹的 阅读(73) 评论(0) 推荐(0)
上一页 1 ··· 49 50 51 52 53 54 55 56 57 ··· 65 下一页