HeyuNas @ 2024-03-10 17:47:14
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
int l, m;
cin >> l >> m;
cout << endl;
int p[10001],a,b;
int j = 0;
for (int i = 0; i <= l; i++)
p[i] = 1;
for (int i = 0; i < m; i++)
{
cin >> a>> b;
for (int k = a; k <= b; k++)
{
p[k] = 0;
}
}
int count=0;
for (int t = 0; t <= l; t++)
{
if (p[t] !=0)
count++;
}
cout << count;
return 0;
}
by SwethessPotion @ 2024-03-10 17:57:42
@HeyuNas 把你第cout << endl;
删了
by HeyuNas @ 2024-03-10 19:43:15
@SwethessPotion 十分感谢,