Kyleshao @ 2023-02-14 12:35:47
#include <iostream>
using namespace std;
bool a[10005];
int main()
{
int l,m;
cin>>l>>m;
for (int i=1;i<=m;i++)
{
int b,c;
cin>>b>>c;
for (int i=b;i<=c;i++)
{
a[i]=true;
}
}
int cnt=0;
for (int i=1;i<=l;i++)
{
if (!a[i])
{
cnt++;
}
}
cout<<cnt+1<<endl;
return 0;
}
补充:cnt+1是因为我发现本来cnt是10分,加了1就90分了
by InversionShadow @ 2023-02-14 12:38:04
@Kyleshao 是从
by wyc0809 @ 2023-04-05 21:12:31
你试试把+1去掉,把第二个循环i从0开始(虽然不知道错哪里了,但经过一通瞎改就过了,啊哈哈哈哈)