Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
119871 朱安然 校门外的树 C++ Accepted 1 MS 276 KB 460 2025-05-21 14:05:22

Tests(10/10):


Code:

#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; // 检查这里有没有漏分号 }