Run ID:162747
提交时间:2026-10-18 17:58:57
#include <bits/stdc++.h> using namespace std; int main() { int a,b; cin>>a>>b; bool c[10001]={false}; int d,e; for (int i=0;i<b;++i) { cin>>d>>e; if (d>e)swap(d,e); for (int j=d;j<=e;j++) { c[j]=true; } } int f=0; for (int i=0;i<=a;i++) { if(c[i])f++; } cout<<(a+1-f)<<endl; return 0; }