逆天10分
查看原帖
逆天10分
1686554
TANK_300楼主2025/8/2 18:04

逆天,我在其他机构写的时候全AC了,一到这来就费了
不想多写文字了

#include <bits/stdc++.h>
using namespace std;
int main(){
    int l,m;
    int st,ed;
    int ans = 0;
    bool s[1111];
    cin>>l>>m;
    for(int i=0;i<=l;i++){
    	s[i] = true;
    }
    for(int i=1;i<=m;i++){
        cin>>st>>ed;
        for(int j=st;j<=ed;j++){
            s[j] = false;
        }
    }
    
    for(int i=0;i<=l;i++){
        if(s[i] == true) ans++;
    }
    cout<<ans;
}
2025/8/2 18:04
加载中...