#include <stdio.h> #include<stdlib.h> int main() { int L, c; scanf("%d %d", &L, &c); int* arr = (int*)calloc(L + 1, sizeof(int)); while (c--) { // 注意 while 处理多个 case int low, high; scanf("%d %d", &low, &high); for (int i = low; i <= high; ++i) { arr[i] = 1; } } int cnt = 0; for (int i = 1; i <= L; ++i) { if (arr[i] == 0) { ++cnt; } } printf("%d", cnt + 1); return 0; }