求大老帮调vector的码
查看原帖
求大老帮调vector的码
595589
qwer111t楼主2024/10/30 16:10
#include<bits/stdc++.h>
using namespace std;
vector<int> tree;
int main(){
	int l,m,a,b,s = 0;
	cin >> l >> m;
	for(int i = 1;i <= m;i++){
		cin >> a >> b;
		for(int j = a;j <= b;j++){
			tree[j] = true;
		}
	}
	for(int i = 0;i <= l;i++){
		if(tree[i] == false){
			s++;
		}
	}
	cout << s;
	return 0;
}
2024/10/30 16:10
加载中...