Rubia_Hua @ 2023-01-13 18:03:30
#include<stdio.h>
int main()
{
int i, j, l, m, z = 0;
scanf("%d%d", &l, &m);
int S[110], SS[110], b[11000];
for (i = 0; i < m; i++)
scanf("%d%d", &S[i], &SS[i]);
for (i = 0; i < l ; i++)
b[i] = 0;
for (i = 0; i < m; i++) {
for (j = S[i]; j <= SS[i]; j++)
b[j] = 1;
}
for (i = 0; i < l + 1; i++)
if (b[i] == 0)
z++;
printf("%d", z + 1);
return 0;
}
by maomao233 @ 2023-01-13 18:06:16
第二个循环是到
by maomao233 @ 2023-01-13 18:07:13
输出直接输出
by maomao233 @ 2023-01-13 18:08:07
@Rubia_Hua
by telankesi @ 2023-01-13 18:12:40
@Rubia_Hua ```c for (i = 0; i < l ; i++) if (b[i] == 0) z++;
试试看
by Rubia_Hua @ 2023-01-13 18:18:48
@maomao233 通过了谢谢谢谢!!