Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
44102 | chenyanda | 校门外的树 | C++ | Accepted | 1 MS | 256 KB | 325 | 2024-03-29 14:50:37 |
#include<iostream> using namespace std; int main() { int l,m,sum=0,a[10000],b,c; cin>>l>>m; for(int i=0;i<=l;i++){ a[i]=1; } for(int i=0;i<m;i++){ cin>>b>>c; for(int j=b;j<=c;j++){ a[j]=0; } } for(int i=0;i<=l;i++){ if(a[i]==1){ sum++; } } cout<<sum; return 0; }