上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 65 下一页
摘要: 原题链接 题解 贪心,遇到大坑就建立一条到小坑自动减少的区间 code #include<bits/stdc++.h> using namespace std; int a[100005]; int main() { int n; cin>>n; int sum=0; for(int i=1;i<= 阅读全文
posted @ 2024-06-26 13:08 纯粹的 阅读(16) 评论(0) 推荐(0)
摘要: 原题链接 题解 随便找两个数字,删哪个更优? 发现了什么规律? code #include<bits/stdc++.h> using namespace std; struct node { int v,id,l,r; }c[300]; int main() { string s; cin>>s; 阅读全文
posted @ 2024-06-26 11:50 纯粹的 阅读(15) 评论(0) 推荐(0)
摘要: 原题链接 题解 对于线段A,选与线段A有交叉,且结束时间比A晚的线段一定不比选线段A更优 code #include<bits/stdc++.h> using namespace std; struct node { int l,r; }seg[1000005]; bool cmp(node a,n 阅读全文
posted @ 2024-06-26 11:11 纯粹的 阅读(27) 评论(0) 推荐(0)
摘要: 原题链接 题解 先考虑操作一,首先要数组总和不小于 \(s\) 其次,我们可以通过两边删数来得到子数组,如果两边任一边有二,我们删掉二之后, \(sum\) 减二,如果全是一,我们两边的一都删掉(数组长度大于1), \(sum\) 减二,所以如果 \(sum\) 是偶数,那么我一定能得到 \([2, 阅读全文
posted @ 2024-06-25 20:14 纯粹的 阅读(18) 评论(0) 推荐(0)
摘要: 原题链接 题解 对于最后一个A,其右边的B都能走 对于倒数第二个A,他能走到第一个A之前的位置 ... 第一个A到最后一个B的距离 code #include<bits/stdc++.h> using namespace std; int a[15]; int solve() { int n; ci 阅读全文
posted @ 2024-06-25 19:01 纯粹的 阅读(14) 评论(0) 推荐(0)
摘要: 原题链接 题解 对于 \(n\) 来说,所有数都比他小,所以他一定能到达数组末尾 对于 \(n-1\) 来说,同理 ... 所以 1 一定要在开头 code #include<bits/stdc++.h> using namespace std; int a[15]; bool solve() { 阅读全文
posted @ 2024-06-25 18:59 纯粹的 阅读(15) 评论(0) 推荐(0)
摘要: 原题链接 题解 如果合集不等于全集,那么全集一定有合计没有的元素,所以遍历全集的元素,然后在找出所有没有该元素的子集,累加判断大小 code #include<bits/stdc++.h> using namespace std; int a[55][55]={0}; int vis[55]={0} 阅读全文
posted @ 2024-06-23 00:04 纯粹的 阅读(16) 评论(0) 推荐(0)
摘要: 原题链接 题解 把(当作+1,)当作-1,我们可以得到这样的图像 易得要保证翻完之后整体的合法性,\([l,r]\) 内的左右括号数量要相等,在图上看就是 \(pre[l-1]==pre[r]\) 相等 一个合法括号,要保证所有的 \(pre[i]\) 不小于0,因此反过来之后,最小的 \(pre[ 阅读全文
posted @ 2024-06-20 17:50 纯粹的 阅读(40) 评论(0) 推荐(0)
摘要: 原题链接 请点击这里 这篇题解有一个小前提,那就是我们可以把变成多少种数组看成删掉哪些数 code #include<bits/stdc++.h> using namespace std; #define ll long long const ll mod = 998244353; ll a[300 阅读全文
posted @ 2024-06-19 19:52 纯粹的 阅读(40) 评论(0) 推荐(0)
摘要: 原题链接 题解 1.观察样例易得改变是有后继性的 2.总是解题时没有思路,一点拨就有思路,怎么办? 我们要找到一些规律,即一定会发生的现象 3.当我们对一场比赛的晋级规律进行修改后,这场比赛的晋级人数取决于其先前两场比赛的晋级人数 实施 1.参考线段树,将第 \(i\) 场比赛改为id为 \(2^k 阅读全文
posted @ 2024-06-19 16:27 纯粹的 阅读(13) 评论(0) 推荐(0)
上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 65 下一页