心得
CTRL Z停止输入
如何输入两行多组数据
[蓝桥杯 2013 省 AB] 错误票据 - 洛谷
while(cin>>a[i++])
or
string s
getline(cin>>s)
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
const int N = 1e5+10,M = 1e9+10;
int a[N];
signed main()
{
std::ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int n;cin>>n;
int cnt =0;while(cin>>a[cnt++]);
sort(a,a+cnt);//little to big
int c,d;
for(int i=1;i<cnt;i++)
{
if(a[i-1]==a[i])c = a[i-1];
else if(a[i-1]+1!=a[i])d=a[i-1]+1;//5 6 8 9 9 10 11 12
}
cout<<d<<" "<<c<<endl;
return 0;
}