AcWing 1204. 错误票据
原题链接
简单
作者:
尼古拉斯小布丁
,
2021-04-12 09:26:57
,
所有人可见
,
阅读 371
简单模拟
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
const int N = 100010;
const int M = 150;
int a[N];
int num;
int m,n;
int minn=N,maxx=-1;
int main(){
scanf("%d", &num);
char flag='0';
int b;
while(num--){
while(flag!='\n'){
scanf("%d%c",&b,&flag);
a[b]++;
minn = min(minn,b),maxx = max(maxx, b);
}
flag='0';
}
for(int i=minn+1;i<maxx;i++){
if(a[i]==0) m = i;
if(a[i]>1) n = i;
}
cout<<m<<" "<<n<<endl;
return 0;
}