题解 1099: 校门外的树

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

筛选

校门外的树 (C++代码)

摘要:解题思路:利用标记数组注意事项:明确端点是否包含其中参考代码:#include <iostream>using namespace std;int main (){ int l,m; cin>>l>>……

校门外的树 (C语言代码)

摘要:解题思路:注意事项:参考代码:#include "stdio.h"int main(int argc, char* argv[]){ int a[100][2],b[10000],L,M,i,j,k,……

校门外的树 (C语言代码)

摘要:解题思路:删去所以车段的交集,每个车段需要“砍树”为:(末-起+1),原本可以植树总共为 :(l+1),结果是:(总-砍)注意事项:参考代码:#include<stdio.h>#define M 10……

校门外的树 (C语言代码)

摘要:解题思路:注意事项:参考代码:#include<stdio.h>                      int main()                             {      …

校门外的树 (C语言代码)

摘要:解题思路:注意事项:参考代码:#include<iostream>using namespace std;int main(){ int L,M; cin>>L>>M; int qishi[100],……

校门外的树 (C语言代码)

摘要:解题思路:我们只需要用数组模拟一下即可。参考代码:#include <stdio.h> #include <string.h> int main() {     int l, m;     ……

校门外的树 (C语言代码)

摘要:解题思路:定义数组表示树,初始化为0,若被挖去,则赋值为1,最后统计数组中1的个数。注意事项:参考代码:#include<stdio.h>int main(){    int *a;    int l……

校门外的树 (C语言代码)

摘要:解题思路:设一个长度为L+1的数组,将每个元素赋值为1,将要毁掉的区域(对应数组的区域)赋值为0,然后统计还剩下几个1即可注意事项:参考代码:#include <stdlib.h>#include <……

校门外的树 (C语言代码)

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int L,M,i,a,b,s[10001],count=0; scanf("%d %d",&L,&M); fo……

校门外的树 (C++代码)

摘要:解题思路:为何要用线段树?只是为了炫耀你们的学识吗?用树状数组难道不是更好吗?思路:树状数组的经典应用二:区间更新、单点查询,维护的是数列的差分数组(t[i]=a[i]-a[i-1]),区间加就显得很……