80分求助
查看原帖
80分求助
1493251
xiaoyu_mc楼主2024/10/4 02:52
#include <iostream>
#include <cmath>
using namespace std;

int main(){
	
	int l, m, u[100], v[100], result, tree[10000], temp;
	cin>>l>>m;
	temp=l; 
	
	while (temp>=0){
		tree[temp]=1;
		temp--;
	}
	while (m>0){
		cin>>u[m]>>v[m];
		for (temp=u[m];temp<=v[m];temp++){
			tree[temp]=0;
		}
		m--;
	}
	while (l>=0){
		if (tree[l] == 1){
			result++;
		}
		l--;
	}
	
	cout<<result;
	
	return 0;
} 

头两个爆红了 求大佬指教

2024/10/4 02:52
加载中...