yuwuyanqiu @ 2023-06-06 23:35:25
#include<bits/stdc++.h>
using namespace std;
int a[100001];
int main()
{
int l,m,c,b,s=0;
cin>>l>>m;
for(int j=1;j<=m;j++){
cin>>c>>b;
for(int i=1;i<=l+1;i++){
if(i>=c&&i<=b){
a[i]++;
}
}
}
for(int i=1;i<=l;i++){
if(a[i]!=0){
s++;
}
}
cout<<endl<<(l+1)-s;
return 0 ;
}
by elbissoPtImaerD @ 2023-06-06 23:56:21
@yuwuyanqiu 第 21 行:cout<<endl<<(l+1)-s;
,您在输出答案数字之前输出了 endl
,即换行符,你的第一行就是空行了,系统比对文件时会返回 WrongAnswer。
by elbissoPtImaerD @ 2023-06-06 23:56:42
要按题目的输出格式输出
by yuwuyanqiu @ 2023-06-07 00:00:27
@elbissoPtImaerD太感谢了,但wa了一个
by elbissoPtImaerD @ 2023-06-07 00:02:55
@yuwuyanqiu 题目要考虑的范围是
by yuwuyanqiu @ 2023-06-07 20:43:01
AC了感谢