xixishowtime @ 2024-10-04 15:58:14
#include <cstdio>
int main(){
int l, m, u, v, cnt = 0, a[10005] = {1};
scanf("%d %d", &l, &m);
while(m--){
scanf("%d %d", &u, &v);
a[u]--;
a[v + 1]++;
}
for(int i = 0; i <= l; i++){
a[i] += a[i - 1];
cnt += a[i] > 0;
}
printf("%d", cnt);
return 0;
}
肯定是学到差(chà)分了吧
by llamn @ 2024-10-04 16:05:02
@xixishowtime 没初始化
by xixishowtime @ 2024-10-04 19:51:31
我写了
cnt = 0, a[10005] = {1}
了呀?