sicily 1200

#include "iostream"
#include "set"
using namespace std;
int main()
{
	int n;
	while (cin >> n && n != 0)
	{
		int *a = new int[n];
		for (int i = 0; i < n; i++)
			cin >> a[i];
		multiset<int> m;
		for (int i = 0; i < n; i++)//将数组中的数添加到容器中
			 m.insert(a[i]);
		multiset<int>::iterator it;
		for (int i = 0; i < n; i++)
			for (int j = i+1; j < n; j++)
				if (a[i] == a[j])//查找重复的数字,如果是重复的就将这个数中容器中删除
					m.erase(a[i]);
		for (it = m.begin(); it != m.end(); it++)
			cout << *it << endl;
	}
}

 

你可能感兴趣的:(iterator,include)