asdf_ @ 2022-12-17 21:22:49
int tot;
int b;
int i;
int ans=0;
int q,p;
int a[10005];
cin>>tot>>b;
for(i=0;i<tot;i++){
a[i]=i;
}
while(b--){
cin>>q>>p;
for(i=q;i<=p;i++){
a[i]=-1;
}
}
for(i=0;i<=tot;i++){
if(a[i]>=0){
ans++;
}
}
cout<<ans;
return 0;
}
by Katz @ 2022-12-17 21:26:06
for(i=0;i<tot;i++){
忘记加=了,应该是
for(i=0;i<=tot;i++){
by asdf_ @ 2022-12-18 10:20:06
@PMAC 对了对了谢谢大佬啊