错误票据(类桶排序)
C++ 代码
#include <iostream>
#include <algorithm>
using namespace std;
const int M=100010;
int a[M]; //全局数组,未初始化时,默认值都是 0;
int main()
{
int Max=0,Min=100001,num;
int m,n;
//类似于桶排序,对每个出现过的数进行标记
while(cin>>num){
a[num]++;
//找到最大值和最小值,并以此作为范围边界
Max=max(Max,num);
Min=min(Min,num);
}
for(int j=Min;j<=Max;j++)
{
if(a[j]==0){
m=j;
}
else if(a[j]==2)
{
n=j;
}
}
cout<<m<<" "<<n<<endl;
return 0;
}
`
没通过啊