提交时间:2024-10-27 10:02:44

运行 ID: 54313

#include<bits/stdc++.h> using namespace std; int main(){ int l, m, start, end, s = 0, a[10001]; cin >> l >> m; for(int i = 0; i <= l; i++){ a[i] = 1; } for(int i = 1; i <= m; i++){ cin >> start >> end; for(int i = start; i <= end; i++){ a[i] = 0; } } for(int i = 0; i <= l; i++){ if(a[i] == 1){ s += 1; } } cout << s; return 0; }