Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
26112 | YOYOLEE-李昕颖 | 校门外的树 | C++ | 通过 | 0 MS | 256 KB | 391 | 2023-08-30 14:36:17 |
#include <iostream> #include <iomanip> using namespace std; int l,m,a[10001],b[200],c; int main() { cin>>l>>m; for(int i=0;i<=l;i++){ a[i]=1; } for(int i=0;i<2*m;i++){ cin>>b[i]; } for(int i=0;i<2*m;i+=2){ for(int j=b[i];j<=b[i+1];j++){ if(a[j]=1){ a[j]=0; } } } for(int i=0;i<=l;i++){ if(a[i]==1){ c++; } } cout<<c; return 0; }