90WA求助
查看原帖
90WA求助
524091
dami826楼主2022/10/23 19:55
#include<iostream>
using namespace std; 

int main(){
	int a,n,s=0;
	cin>>a>>n;
	bool A[a+1];
	for(int k=1;k<=a+1;k++){
		A[k]=true;
	}
	for(int i=1;i<=n;i++){
		int x,y;
		cin>>x>>y;
		for(int j=x;j<=y;j++){
			A[j]=false; 
		}
	}
	for(int l=1;l<=a+1;l++){
		if(A[l]==true){
			s++;
		}
	}
	cout<<s;
	return 0;
}
2022/10/23 19:55
加载中...