1099: 校门外的树 摘要:解题思路:设一个数组全为0,输入l长度,将数组l长度的元素设为1。一次次输入需要规划的起点和终点,在数组中,将这些区域设0;最后统计1的个数。注意事项:注意端点0与l,都应该取到。参考代码:#incl…… 题解列表 2024年03月11日 1 点赞 0 评论 190 浏览 评分:9.9
校门外的树 摘要:解题思路:把马路的长当作数组长,在数组中全录入1,代表栽了树;在后续输入的数据中,两两为一组,在上一个数组中把一组的值变为0即可,则不需要考虑重复区域的问题,最后计算1的数量即可注意事项:参考代码:#…… 题解列表 2024年03月09日 0 点赞 0 评论 107 浏览 评分:0.0
1099: 校门外的树 摘要:``` #include using namespace std; const int N=10010; int a[N]; int main() { int n,m; cin>>n…… 题解列表 2023年12月25日 0 点赞 0 评论 149 浏览 评分:9.9
1099:校门外的树 摘要:``` #include using namespace std; const int N=10010; int a[N]; int main() { int n,m; cin>>n…… 题解列表 2023年12月25日 0 点赞 0 评论 97 浏览 评分:9.9
校门外的树(c++) 摘要:解题思路:树是连续的可以用数组来存储,根据区间来遍历,更改数组状态。注意事项:用来存储树的数组需要比极限略微大一点的空间,否则会有段错误。参考代码:#include<bits/stdc++.h> #…… 题解列表 2023年12月10日 0 点赞 0 评论 128 浏览 评分:0.0
Yu校门外的树(差分+前缀和) 摘要:# 解题思路 简单循环模拟题解很多人发过了,我这里提供一种高效方法。 # 参考代码 ```c++ #include using namespace std; int main() {…… 题解列表 2023年12月01日 0 点赞 0 评论 102 浏览 评分:2.0
题解 1099: 校门外的树 摘要: #include using namespace std; int a[100000],c,b,sum,d,e,f; int main(){ cin…… 题解列表 2023年12月01日 0 点赞 0 评论 182 浏览 评分:0.0
1099: 校门外的树 摘要:``` #include using namespace std; int l,r,L[10001],n,m; int main() { cin>>n>>m; for(int i=0;…… 题解列表 2023年11月28日 0 点赞 0 评论 143 浏览 评分:8.0
1099: 校门外的树(C++) 摘要:解题思路:先对区间的起始点进行顺序排序,方便直接讨论区间终点的大小情况,根据情况对重复的区间进行去除,对衔接的区间进行拼接另外有先对整段区间赋值,再根据区间改变赋值,简化区间情况讨论的作法。参考代码:…… 题解列表 2023年10月17日 0 点赞 0 评论 176 浏览 评分:9.9
利用区间合并的思想求解 摘要:解题思路: 将区间合并之后即可解决区间重合问题注意事项: 注意数据类型参考代码:#include<iostream>#include<algorithm>#include<vector>using n…… 题解列表 2023年09月23日 0 点赞 0 评论 127 浏览 评分:0.0