Bootstrap

每日一题蓝桥杯P8598 [蓝桥杯 2013 省 AB] 错误票据c++

#include<iostream>
using namespace std;
int main() {
	int n;
	int s[100000] = { 0 };
	int t;
	int duan;
	int chong;
	while (cin >> t) s[t]++;
	for (int i = 1; i < 100000; i++) {
		if (s[i - 1] && s[i + 1]) {
			if (!s[i]) {
				duan = i;
			}
		}
		if (s[i] > 1)chong = i;
		if (chong && duan)break;
	}
	cout << duan << " " << chong << endl;
	return 0;
}

;