總時間限制:
1000ms
內存限制:
65536kB
// 在此處補充你的代碼
描述
程序填空,使其按要求輸出
#include <iterator> #include <vector> #include <map> #include <set> #include <queue> #include <algorithm> #include <stack> #include <iostream> #include <set> using namespace std; int main() { int t; int a[100]; cin >> t; while(t--) { for(int i = 0;i < 12; ++i) cin >> a[i];
std::copy(b.begin(), b.end(), c); cout << endl; } return 0; }
輸入
第一行是個整數,表示輸入數據組數
每組數據一行,有12個整數
輸出
對每組數據, 將12個整數從小到大排序並去除重複元素後輸出
樣例輸入
2 34 5 4 6 3 9 8 34 5 3 3 18 31 2 4 6 2 9 8 31 5 3 3 18
樣例輸出
3 4 5 6 8 9 18 34 2 3 4 5 6 8 9 18 31
提示
注意:行末都有一個空格
#include <iterator>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <stack>
#include <iostream>
#include <set>
using namespace std;
int main() {
int t;
int a[100];
cin >> t;
while(t--) {
for(int i = 0;i < 12; ++i)
cin >> a[i];
// 在此處補充你的代碼
sort(a,a+12);
vector<int>b;
b.push_back(a[0]);
for(int j=1;j<12;j++)
{
if(a[j]==a[j-1])
{
continue;
}
else
{
b.push_back(a[j]);
}
}
//這句還真沒見過
ostream_iterator<int> c(cout," ");
//
std::copy(b.begin(), b.end(), c);
cout << endl;
}
return 0;
}