【bzoj2761】[JLOI2011]不重复数字

水题

set判重即可

oj上没有忽略行末空格

#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<set>
using namespace std;

typedef long long LL;

set<LL>S;

LL T;
LL n;
LL x;

int main()
{
	scanf("%lld",&T);
	while (T--)
	{
		S.clear();
		scanf("%lld",&n);
		scanf("%lld",&x);
		printf("%lld",x);
		S.insert(x);
		for (LL i=2;i<=n;i++)
		{			
			scanf("%lld",&x);
			if (S.count(x)==0)
			{
				printf(" %lld",x);
				S.insert(x);
			}
		}
		printf("
");
	}
	return 0;
}

  

原文地址:https://www.cnblogs.com/yangjiyuan/p/5647932.html