题目大意:去重后输出
题解:可以考虑用排序,hash等巧(正)妙(常)的方法。不过我直接用stl水过了(unordered_set直接CE,233),离散化做法
我的收获:…………
#include <cstdio>
#include <iostream>
#include <set>
using namespace std;
int T,n,x;
set<int> s;
void work()
{
for(int i=1;i<=n;i++)
{
scanf("%d",&x);
if(s.count(x)==0){
if(i==1) printf("%d",x);
else printf(" %d",x);
s.insert(x);
}
}
putchar('\n');
}
void init()
{
s.clear();
scanf("%d", &n);
}
int main()
{
cin>>T;
while(T--){
init();
work();
}
return 0;
}