应该对吧

lkyLKY(祝忘羡99版)  •  6天前


include

using namespace std; int a[10005];

int main() {

int L, M;
cin >> L >> M;
for (int i = 0; i < 10005; i++) {
	a[i] = 1;
}
for (int i = 1; i <= M; i++) {
	int x, y;
	cin >> x >> y;
	for (int j = x; j <= y; j++)
		a[j] = 0;
}
int ans = 0;
for (int i = 0; i <= L; i++) {
	if (a[i]) {
		ans++;
	}
}
cout << ans;
return 0;

}


评论:

请先登录,才能进行评论