sicily 1306

#include "iostream"
#include "set"
#include "algorithm"
using namespace std;
int main()
{
	int n, m;
	/*multiset<int> s;
	multiset<int>::iterator it;*/
	while (cin >> n >> m && m != 0 && n != 0)
	{
		int *a = new int[n];
		for (int i = 0; i < n; i++)
			cin >> a[i];
		sort(a, a+n);
		for (int i = 0; i < n; i += m)
		{
			if (i != 0)
				cout << " ";
			cout << a[i];
		}
		/*for (int i = 0; i < n; i++)
			s.insert(a[i]);
		int j;
		for (it = s.begin(), j = 0; it != s.end(), j < s.size(); it++, j ++)
		{
			if (j % m == 0)
			{
				if (j != 0)
					cout << " ";
			    cout << *it;
			}
		}*/
		cout << endl;
	}
}
当我用注释中的代码提交的时候,竟然WA,好似两个运行的结果一样,不知道哪里出错!郁闷!
 

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