1 条题解

  • 1
    @ 2025-2-15 10:34:13
    #include <bits/stdc++.h>
    using namespace std;
    int arr[10005];
    int main(){
       int l , m , ans = 0;
       cin >> l >> m;
       int x , y;
       for(int j = 0; j < m; j++){
       cin >> x >> y;
       for(int i = x; i <= y; i ++){
          arr[i] = 1;
       }
       }
       for(int i = 0; i <= l; i++){
          if(arr[i] == 0){
             ans += 1;
          }
       }
       cout << ans;
    
    
    
    
    
       return 0;
    }
    
    • 1

    信息

    ID
    682
    时间
    1000ms
    内存
    128MiB
    难度
    6
    标签
    (无)
    递交数
    54
    已通过
    18
    上传者