提交时间:2025-11-07 14:24:34
运行 ID: 73162
#include <iostream> #include <cstring> using namespace std; int main() { int L, M; cin >> L >> M; bool tree[666]; for(int e=0;e<=L;e++){ tree[e]=true; } for(int i=0; i < M; ++i) { int a, b; cin >> a >> b; for (int j = a; j <= b; j++) { tree[j] = false; } } int count = 0; for (int i = 0; i <= L; ++i) { if (tree[i]) count++; } cout << count << endl; return 0; }