题解 1099: 校门外的树

来看看其他人写的题解吧!要先自己动手做才会有提高哦! 
返回题目 | 我来写题解

筛选

c++差分数组解法

摘要:解题思路:这题用数组标记法是可以做的,但可以进一步来降低时间复杂度,不难看出数组标记法中,每一步中都需要对区间内赋值为1,这一步与给区间内加上一个增量的操作等价,可以使用差分数组。这里给小白科普一下差……

1099: 校门外的树

摘要:解题思路:注意事项:参考代码:#include <bits/stdc++.h>typedef long long ll;const int N=1e7;using namespace std;int ……

1099:校门外的树

摘要:``` #include using namespace std; const int N=10010; int a[N]; int main() { int n,m; cin>>n……

1099: 校门外的树

摘要:```cpp #include #include using namespace std; int main() { char L[10001]; memset(L,0,……

1099: 校门外的树

摘要:解题思路:设一个数组全为0,输入l长度,将数组l长度的元素设为1。一次次输入需要规划的起点和终点,在数组中,将这些区域设0;最后统计1的个数。注意事项:注意端点0与l,都应该取到。参考代码:#incl……

1099: 校门外的树

摘要:解题思路:暴力解法,建一个大小为n的数组存储树的状态。时间复杂度是O(n),题解里面那个扫描线差分我还没看懂。注意事项:太暴力太丑陋了。参考代码:// 题目 1099: 校门外的树 #include……

校门外的树

摘要: #include using namespace std; int main() { int L, M, x, y, num = 0; ……

1099: 校门外的树

摘要:解题思路:运用数组去做标记注意事项:参考代码:#include<iostream> using namespace std; int a[100000]={0};  int main() {……

1099: 校门外的树

摘要:``` #include using namespace std; const int N=10010; int a[N]; int main() { int n,m; cin>>n……