Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
119668 蔡胤泽 校门外的树 C++ Accepted 1 MS 308 KB 471 2025-05-18 11:57:22

Tests(10/10):


Code:

#include <iostream> #include <iomanip> // 用于控制输出格式 using namespace std; int main() { int m, n; int trees[10008]; cin >> m >> n; for(int i = 0 ; i <= m;i++) { trees[i] = 1; } for(int j = 0;j < n;j++) { int start, end; cin >> start >> end; for(int t = start;t <= end;t++) { trees[t] = 0; } } n = 0; for(int i = 0 ; i <= m;i++) { if(trees[i] == 1) { n++; } } cout << n; return 0; }