Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
110331 | 胡海峰老师 | 校门外的树 | C++ | Accepted | 1 MS | 308 KB | 434 | 2025-02-16 19:58:44 |
#include <iostream> // 万能头文件 using namespace std; int a[10008]; //默认存的数据是0 int main() { int l ,m; cin>>l >> m; for (int i=0;i<=l;i++) a[i] = 1; for( int j=0;j<m;j++) { int start,end; cin>> start >>end; for(int i=start;i<=end;i++) a[i] = 0; // 打标记 } int res=0; for (int i=0;i<=l;i++) if( a[i]==1 ) res++; cout<<res; }