样例:
8
11 22 33 44 44 55 44 66
44
#include <iostream>
#include<string.h>
#include<string>
#include<algorithm>
using namespace std;//1038: 顺序表中重复数据的删除
int main()
{
int n;
cin >> n;
int a[1000];
for (int i = 0; i < n; i++)
{
cin >> a[i];
}
int m;
cin >> m;
int j = 1;
for (int i = 0; i < n; i++)
{
if (a[i] == m)
{
j++;
if (j == n)
cout << "-1" << endl;
continue;
}
else
{
cout << a[i] << ' ';
}
}
return 0;
}