主站
DreamJudge
院校信息
专业题库
模拟考试
机试真题
专业课程
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
15240928957
2024年3月21日 22:11
Runtime Error 求大佬帮看
P1175
回复 1
|
赞 0
|
浏览 185
#include <iostream> #include <stdlib.h> #include <map> using namespace std; struct node { int a, b; }; map<int, node>v; int f[1005] = { 0 }; int main() { int L, M; cin >> L >> M; &nbs...
huanghu
2024年3月18日 13:36
剩下的树 题解:c++
P1175
回复 0
|
赞 0
|
浏览 198
#include<stdio.h> #include<iostream> using namespace std; //数组先全部初始化为1代表该位置有树,然后根据输入的值逻辑上用0删除,最后遍历数组即可,要注意n个位置有n+1课树 int main(){ int n,m; while(cin>>n>>m){ int arr[10000] = {0}; for(int i = 0; i<n+1; i++){ arr[i] = 1; } for(int i = 0; i<m;...
红毛舒肤佳
2024年3月17日 21:30
剩下的树 题解:数组
P1175
回复 0
|
赞 0
|
浏览 198
#include <bits/stdc++.h> using namespace std; int main(){ int x,m; while(cin>>x>>m){ int L[10005]={0};//用0表示存在树 int len=x+1; for(int i=0;i<m;i++){// int low,high; cin>>low>>high; for...
acd131415
2024年3月10日 18:59
剩下的树 题解:用一个数组记录即可
P1175
回复 0
|
赞 0
|
浏览 188
#include<iostream> using namespace std; int main(){ int m,n; while(cin>>m>>n){ int count=0,arr[101][2]; int f[10002]={0}; &nbs...
jz拿遍offer
2023年7月12日 11:34
差分数组求解:
P1175
回复 0
|
赞 1
|
浏览 629
#include <bits/stdc++.h> using namespace std; int main() { int L, M; while(cin>>L>>M) { int l, r, num=0; int* Trees = new int[L+1]; int* d = new int[L+1]; for(int i=0; i<=L; i++) { Trees[i] = 1; ...
Sacan
2022年6月11日 12:15
差分数组
P1175
回复 0
|
赞 1
|
浏览 5.5k
频繁修改区间。如果修改次数和范围较大,无脑暴力可能会超时,这时候就需要差分数组,快速修改区间值 #include <iostream> #include <vector> using namespace std; int main() { int L,M; while(cin >> L >> M){ // [1, L+1]是树 vector<int> arr(L+3, 1); arr[0] = 0; arr[L+2]...
老猫
2021年1月20日 11:39
过
P1175
回复 0
|
赞 2
|
浏览 10.1k
#include <iostream> #include <string> #include <string.h> #include <map> using namespace std; int main() { int L,n; while(cin>>L>>n) { int beg,end; int a[10000]={0}; int cnt=L+1; for(int i=0;i<n;i++) { cin>>beg>>...
题目
剩下的树
题解数量
7
发布题解
热门题解
1
过
2
差分数组
3
差分数组求解:
4
Runtime Error 求大佬帮看
5
剩下的树 题解:数组
6
剩下的树 题解:c++
7
剩下的树 题解:用一个数组记录即可