首页 > 其他 > 详细

【bzoj2761】[JLOI2011]不重复数字

时间:2016-07-06 20:19:17      阅读:249      评论:0      收藏:0      [点我收藏+]

水题

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("\n");
	}
	return 0;
}

  

【bzoj2761】[JLOI2011]不重复数字

原文:http://www.cnblogs.com/yangjiyuan/p/5647932.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!