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 评论 192 浏览 评分:8.0
编写题解 1099: 校门外的树C++ 摘要:```cpp #include /* 文件头可以随便,我喜欢万能头,这里也可以(注意有memset函数,要用cstring库): #include #include */ using …… 题解列表 2024年11月26日 7 点赞 1 评论 895 浏览 评分:8.0
校门外的树 (C语言代码) 摘要:解题思路:根据题目很容易想到数组,可以将先创建一个长度为10001的数组tree(也可以在输入L后再定义tree)(注意一定要是10001,因为L最大为10000,再加上原点,长度应是10001),再…… 题解列表 2019年05月17日 3 点赞 0 评论 1104 浏览 评分:8.3
校门外的树 (C++代码) 摘要:解题思路:1、使用数组模拟树2、有树的位置为1,移除树的位置为03、统计最后为 1 的位置的数目,即为最后剩余树的数目注意事项:参考代码:#include<iostream> using names…… 题解列表 2018年05月11日 0 点赞 0 评论 2569 浏览 评分:8.6
校门外的树-题解(C++代码) 题虽水,但题解不能水(线段树+懒人标记) 摘要:```cpp #include "iostream" #include "cstdio" #include "cstdlib" #include "cstring" #include "cm…… 题解列表 2019年08月15日 0 点赞 0 评论 985 浏览 评分:8.7
校门外的树 (C++代码)我的第一次题解 摘要:#### 树是0到L,所以树的数量是:L+1 #### 先建立一个“树”数组,全部赋值成1表示有树 #### 然后再输入M的区域的时候循环,从开始点到结束的赋值成0 #### 最后循环判断“数”…… 题解列表 2019年12月29日 0 点赞 0 评论 594 浏览 评分:8.7
优质题解 校门外的树 (C++代码) 摘要:解题思路:用较大的数组标记,开始时全部设置为1(表示有树),循环控制输入次数,依次输入开始和结尾数据,在范围内的设置为0(没树)。注意事项:标记数组一定要够大。参考代码:#include<iostre…… 题解列表 2018年05月27日 13 点赞 3 评论 2764 浏览 评分:8.8
校门外的树(python)代码非常简单易懂 摘要:### 各位看官看明白了给个好评,这里运用了集合的不重复的性质来求解 l,m = map(int,input().split()) k = [] for i in range(m): …… 题解列表 2021年05月30日 0 点赞 0 评论 1170 浏览 评分:8.9
校门外的树-题解(Python代码) 摘要:本题笔者直接用了filter筛选,可以实现。 但是问题在于如果直接用filter迭代会只有最后一次筛选的结果。 ```python l,o=map(int,input().split()) l…… 题解列表 2019年08月26日 0 点赞 2 评论 1021 浏览 评分:9.0
校门外的树-题解(C++代码) 比较高效的做法 摘要:使用map实现有序插入和遍历起点-终点。 参考代码: ```cpp #include #include #include using namespace std; int mai…… 题解列表 2019年10月16日 0 点赞 0 评论 834 浏览 评分:9.0