直接贴代码:
#include <iostream> using namespace std; int main() { int l,m,start,end; while (cin>>l>>m) { if(0 == l) break; ++l; for (int i=0;i<m;++i) { cin>>start>>end; l -= (end-start+1); } cout<<l<<endl; } return 0; }
时间: 2024-10-31 08:53:11
直接贴代码:
#include <iostream> using namespace std; int main() { int l,m,start,end; while (cin>>l>>m) { if(0 == l) break; ++l; for (int i=0;i<m;++i) { cin>>start>>end; l -= (end-start+1); } cout<<l<<endl; } return 0; }