70求助
查看原帖
70求助
363845
wu_wowo楼主2020/12/19 19:25
#include<bits/stdc++.h>
using namespace std;
bool a[10010];
int num;
int kanshu;
int tou,wei;
int shushu=0;
int main(){
	cin>>num;
	cin>>kanshu;
	for(int i=1;i<=kanshu;i++){
		cin>>tou>>wei;
		for(int j=tou;j<=wei;j++){
			a[j]=1;
		}
	}
	for(int i=0;i<num;i++){
		if(a[i]==0) shushu++;
	}
	shushu++; 
	cout<<shushu;
    return 0;
} 
2020/12/19 19:25
加载中...