Run ID:119871
提交时间:2025-05-21 14:05:22
#include <iostream> #include <vector> using namespace std; int main() { int L, M; cin >> L >> M; vector<bool> trees(L + 1, true); while (M--) { // 改用while更保险 int a, b; cin >> a >> b; for (int i = a; i <= b; ++i) trees[i] = false; } int cnt = 0; for (int i = 0; i <= L; ++i) if (trees[i]) cnt++; cout << cnt; return 0; // 检查这里有没有漏分号 }