落落紫qwq @ 2023-01-09 14:12:13
x, y = map(int, input().split()) a, b = map(int, input().split()) c, d = map(int, input().split()) e, f = map(int, input().split()) n = [] z = 0 for i in range(x): n.append(0) for i in range(x): if i in range(a, b+1): n[i] = 1 if i in range(c, d+1): n[i] = 1 if i in range(e, f+1): n[i] = 1 for i in range(x): if n[i] == 0: z += 1 print(z+1)
求问错误在哪
by xiaoqian02 @ 2023-01-09 14:40:27
望丰展?使 Md。(注:请学习一下这个)
by jomy @ 2023-01-09 14:44:26
?❀缭乱
by Jasonshan10 @ 2023-01-12 20:00:33
建议使用Md,格式如下
第一行```cpp
中间代码部分
最后一行```
by sunnyboy985 @ 2023-01-13 16:06:19
可以参考一下
#include<bits/stdc++.h>
using namespace std;
int a[10010];
int main() {
int l,m,c;
cin>>l>>m;
for(int i=0;i<=l;i++){
a[i]=1;
}
int x,y;
for(int i=1;i<=m;i++){
cin>>x>>y;
for(int j=x;j<=y;j++){
a[j]=0;
}
}
for(int i=0;i<=l;i++){
if(a[i]==1)c++;
}
cout<<c;
return 0;
}