Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
2379 | 孙浚轩 | 校门外的树 | C++ | Accepted | 0 MS | 304 KB | 453 | 2023-12-24 14:32:24 |
#include<iostream> using namespace std; int main(){ int l,m,s=0; cin>>l>>m; if(l>=1){ int t[l+1],a[m],b[m]; for(int i=0;i<m;i++) cin>>a[i]>>b[i]; for(int i=0;i<=l;i++) t[i]=1; for(int i=0;i<m;i++){ for(int i1=a[i];i1<=b[i];i1++) t[i1]=0; } for(int i=0;i<=l;i++) s+=t[i]; cout<<s; } return 0; }