AcWing 1204. 错误票据
原题链接
简单
作者:
冉俊泽
,
2021-02-24 20:20:43
,
所有人可见
,
阅读 303
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdio>
#include<stdio.h>
using namespace std;
const int N = 10010;
int cnt[N];
char str[N];
int main()
{
int n;
cin >> n;
int res = 0;
while(n--)
{
int a;
while(cin >> a) cnt[res++] = a;
}
sort(cnt, cnt + res);
int ans1, ans2;
for(int i = 1; i < res; i++)
{
if(cnt[i] == cnt[i - 1]) ans2 = cnt[i];
if(cnt[i] == cnt[i - 1] + 2) ans1 = cnt[i] - 1;
}
cout << ans1 << " " << ans2 << endl;
return 0;
}