BZOJ 2761: [JLOI2011]不重复数字 set

Code:

#include<bits/stdc++.h>
#define maxn 100000 
using namespace std;
void setIO(string s)
{
	string in=s+".in"; 
	freopen(in.c_str(),"r",stdin); 
}
set<int>S; 
set<int>::iterator it; 
int arr[maxn]; 
inline void solve()
{
	int n,i,a; 
	scanf("%d",&n); 
	for(i=1;i<=n;++i) 
	{
		scanf("%d",&a); 
		if(S.find(a)==S.end()) printf("%d ",a), S.insert(a); 
	}
	S.clear(); 
	printf("\n"); 
}
int main()
{
	// setIO("input"); 
	int T; 
	scanf("%d",&T); 
	while(T--) solve(); 
	return 0; 
}

  

猜你喜欢

转载自www.cnblogs.com/guangheli/p/11093406.html
今日推荐