| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 165209 | 格林老师 | 校门外的树 | C++ | Accepted | 1 MS | 312 KB | 480 | 2026-11-14 10:54:46 |
#include <bits/stdc++.h> using namespace std; int a[10001]; int main() { int L,M; cin>>L>>M; for (int i=0;i<=L;i++){ a[i]=1; //代表有树 } for (int i=0;i<M;i++){ int x,y; //代表移走树苗的起点终点 cin>>x>>y; for(int j=x;j<=y;j++){ a[j]=0; } } int cnt=0; for (int i=0;i<=L;i++){ if (a[i]) cnt++; } cout<<cnt<<endl; return 0; }