Liyan100 @ 2023-10-12 01:12:54
#include<stdio.h>
int main()
{
int l,m,initial,end,a[l+1],sum=0,i=0,j;
scanf("%d %d",&l,&m);
while(i<m)
scanf("%d %d",&initial,&end),i++;
for(i=0;i<=l;i++)
a[i]=0;
for(i=0;i<m;i++){
scanf("%d %d",&initial,&end);
for(j=initial;j<=end;j++)
a[j]=1;}
for(i=0;i<=l;i++){
if(a[i]==0)sum++;
}printf("%d",sum);
return 0;
}
by Terrible @ 2023-10-12 01:29:53
#include<stdio.h>
int main()
{
int l,m;
scanf("%d %d",&l,&m);
int begin,end,a[l+1],sum=0,i,j;
for(i=0;i<=l;i++)
a[i]=0;
for(i=0;i<m;i++){
scanf("%d %d",&begin,&end);
for(j=begin;j<=end;j++)
a[j]=1;}
for(i=0;i<=l;i++){
if(a[i]==0)sum++;
}printf("%d",sum);
return 0;
}
by MYiFR @ 2023-10-12 07:46:38
还没有读入