上一页 1 ··· 42 43 44 45 46 47 48 49 50 ··· 65 下一页
摘要: 原题链接 题解 直接插在它后面,这种数据结构是链表 赛时明明想到了链表,但是写的一团糟。。 对于链表,最简单的就是用map了 code #include<bits/stdc++.h> using namespace std; int a[200005]; map<int,int> head,to; 阅读全文
posted @ 2024-03-10 00:20 纯粹的 阅读(43) 评论(0) 推荐(0)
摘要: 原题链接 思路 求最大区间和 \(\to\) 设每个点为区间右端点时的最大区间和 \(f[i]\) ,则答案一定为 \(max(f[i])\) \(\to\) 求最大的 \(f[i]\) \(\to\) 每个 \(f[i]=max(sum[i]-sum[j-1]),j\in[i-k+1,i]\) \ 阅读全文
posted @ 2024-03-09 21:52 纯粹的 阅读(21) 评论(0) 推荐(0)
摘要: 原题链接 题解 太巧妙了!! code #include<bits/stdc++.h> using namespace std; int main() { int n,w; cin>>n>>w; int score[605]={0}; for(int i=1;i<=n;i++) { int x; c 阅读全文
posted @ 2024-03-09 19:15 纯粹的 阅读(73) 评论(0) 推荐(0)
摘要: 原题链接 题解 不能连续选k个元素 \(\to\) 任意每k个元素就有一个不选 \(\to\) 每k个点就有一个断点 \(\to\) 每个点都有可能是断点 \(\to\) dp求解 \(sol.1\) 令 \(f[i]\) 为第i个点为断点且为结尾的最大值 则 \(f[i]=max(f[j]+sum 阅读全文
posted @ 2024-03-09 16:40 纯粹的 阅读(41) 评论(0) 推荐(0)
摘要: 原题链接 题解 一道搜索+模拟 搜索每一位可以放哪个值(\([0,9]\)),然后累加搜索下一位 注意细节 code #include<bits/stdc++.h> using namespace std; #define ll long long ll f[10][105]={0}; ll n,k 阅读全文
posted @ 2024-03-08 20:37 纯粹的 阅读(32) 评论(0) 推荐(0)
摘要: 原题链接 题解 请看清楚题目再下手!! 每次都可以且必须派 \([1,m]\) 条船,然后计算每次任务的最大值,最后求和 code #include<bits/stdc++.h> using namespace std; #define ll long long int main() { ll n, 阅读全文
posted @ 2024-03-08 20:34 纯粹的 阅读(66) 评论(0) 推荐(0)
摘要: 原题链接 题解 直观的 \(O(n)\) 算法很容易想到,但是很不幸,挂了 所以我们要想到 \(O(1)\) 的做法 考虑到斐波那契数列非常有规律,所以我们找找规律 奇,奇,偶,奇,奇,偶。。。 code #include<bits/stdc++.h> using namespace std; #d 阅读全文
posted @ 2024-03-08 18:51 纯粹的 阅读(16) 评论(0) 推荐(0)
摘要: 原题链接 题解 我一开始也很困惑,然后我想要不数据范围小一点我构造看看 当 \(n=5\) 时 \(k=0\) 可不可以 \(k=1\) 可不可以 \(k=2\) 可不可以 然后根据直觉,\(gcd(a,a+1)\) 始终为一,且 一 和任何数的最大公约数都为一,自己和自己的最大公约数还是自己,所以 阅读全文
posted @ 2024-03-08 18:27 纯粹的 阅读(12) 评论(0) 推荐(0)
摘要: 原题链接 题解 这种让来让去让我想到了二分图!! 注意细节!!剩余的就是模拟了 code #include<bits/stdc++.h> using namespace std; int stu[55],gohome[55],know[55][55]; int n; int belong[55]={ 阅读全文
posted @ 2024-03-08 15:48 纯粹的 阅读(9) 评论(0) 推荐(0)
摘要: 原题链接 题解,终于有一道题一遍过了 强连通分量缩点加本题个性化判断 code #include<bits/stdc++.h> using namespace std; vector<int> G[10005]; int order[10005]={0},low[10005]={0},len=0; 阅读全文
posted @ 2024-03-08 15:04 纯粹的 阅读(26) 评论(0) 推荐(0)
上一页 1 ··· 42 43 44 45 46 47 48 49 50 ··· 65 下一页