帮帮看看哪里错了???
查看原帖
帮帮看看哪里错了???
995569
L__B楼主2023/11/12 23:03
#include<bits/stdc++.h>
using namespace std;
long long n,x,a[100001],s1,s2;
signed main(){
    scanf("%lld",&n);
    while(scanf("%lld",&x)) a[x]++;
    for(int i=1;i<=100000;i++){
        if(a[i-1]&&a[i+1]&&!a[i]) s1=i;
        if(a[i]>1) s2=i;
        if(s1&&s2) break;
    }
    printf("%lld %lld",s1,s2);
    return 0;
}
2023/11/12 23:03
加载中...