RE求条
查看原帖
RE求条
1271316
违规用户名K&xs3Z^楼主2024/9/6 18:51
#include<bits/stdc++.h>
using namespace std;
template <typename T> void read(T &x)
{
	x=0;char ch=getchar();int fh=1;
	while (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();}
	while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	x*=fh;
}
const int N=1e6;
int b[N],n,t,x;
bool used[N];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	read(t);
	while(t--){
		memset(b,0,sizeof b);
		memset(used,0,sizeof used);
		read(n);
		for(int i=1;i<=n;i++){
			read(x);
			b[i]=x;
		}
		for(int i=1;i<=n;i++){
			if(!used[b[i]]){
				cout<<b[i]<<" ";
				used[b[i]]=1;
			}
		}
		cout<<endl;
	}
	return 0;
}

2024/9/6 18:51
加载中...