Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
44159 | 承诺 | 校门外的树 | C++ | Accepted | 0 MS | 264 KB | 300 | 2024-03-29 15:07:45 |
#include<bits/stdc++.h> using namespace std; bool tree[10009]; int main(){ int a[109],b[109],l,m,cnt=0; cin>>l>>m; for(int i=1;i<=m;i++) { cin>>a[i]>>b[i]; for(int j=a[i];j<=b[i];j++) tree[j]=1; } for(int i=0;i<=l;i++) if(tree[i]) cnt++; cout<<l+1-cnt; return 0; }