2 solutions
-
0
#include<stdio.h> int main(){ int l,m; scanf("%d %d",&l,&m); int a[l+1]; int i; for(i=0;i<=l;i++){ //初始化树位置,0代表不需移走该下标的树 a[i]=0; } int s,e; for(i=0;i<m;i++){ scanf("%d %d",&s,&e); for(int j=s;j<=e;j++){//标记需移走树的位置 a[j]++; } } int sum=0; for(i=0;i<=l;i++){ if(a[i]==0){ //查找未被标记的树个数 sum++; } } printf("%d",sum); return 0; }
Information
- ID
- 6771
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- 6
- Tags
- (None)
- # Submissions
- 206
- Accepted
- 57
- Uploaded By