文章
6
粉丝
32
获赞
0
访问
2.5k
#include <bits/stdc++.h>
using namespace std;
int main()
{
int l,m;
while (cin>>l && cin>>m) {
int diff[l+5];
memset(diff, 0, sizeof(diff));
diff[0] = 1;
for (int i = 0; i < m; i++) {
int a,b;
cin>>a>>b;
diff[a] -= 1;
diff[b+1] += 1;
}
int sum = 0;
int ans = 0;
for (int i = 0; i <= l; i++) {
sum += diff[i];
if (sum > 0) ans++;
}
cout<<ans<<endl;
...
登录后发布评论
暂无评论,来抢沙发