0分求调
查看原帖
0分求调
772218
theblacksilence楼主2024/7/20 09:58

样例能过,代码:

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[10010]={0},l,m,le,ri,count;
    cin>>l>>m;
    for(int i=0;i<m;i++)
    {
        cin>>le>>ri;
        for(int j=le;j<=ri;j++)
        {
            a[j]=1;
        }
    }
    for(int i=0;i<=l;i++)
    {
        if(a[i]==0)
        {
            count++;
        }
    }
    cout<<count;
    return 0;
}
2024/7/20 09:58
加载中...