kurobal @ 2023-12-13 21:25:56
#include <stdio.h>
int main()
{
int l,m;
scanf("%d %d", &l, &m);
int u[m],v[m];
int num[l+1];
for(int i = 0;i<m;i++){
scanf("%d %d", &u[i],&v[i]);
}
for(int n = 0;n< l+1;n++){
num[n] = 1;
}
for(int k = 0; k <= l; k++){
for(int i = 0;i<m;i++){
if(u[i] <= k <=v[i]){
num[k]=0;
}
}
}
int number = 0;
for(int i = 0;i <= l;i++){
if(num[i]=1){
number++;
}
}
printf("%d", number);
return 0;
}
by DFs_YYDS @ 2023-12-13 21:30:19
@kurobal 你的```cpp using namespace std;
呢?
by DFs_YYDS @ 2023-12-13 21:31:14
@DFs_YYDS 不好意思,不是很会用
using namespace std;
呢?
by liruizhou_lihui @ 2023-12-13 21:43:27
@DFs_YYDS
关于
using namespace std;
这件事
by liruizhou_lihui @ 2023-12-13 21:44:22
@DFs_YYDS
你
by DFs_YYDS @ 2023-12-14 12:13:31
@liruizhou123 是的,我是2b
by DFs_YYDS @ 2023-12-14 12:15:21
看不懂一点
by DFs_YYDS @ 2023-12-14 12:15:58
双重循环是什么东西
by DFs_YYDS @ 2023-12-14 12:19:41
@kurobal 我知道了,你的第27行
num[i]=1
应该为
num[i]==1
不得不说,确实很难懂