社区讨论

RE求条

P4305[JLOI2011] 不重复数字参与者 5已保存回复 4

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
4 条
当前快照
1 份
快照标识符
@m0qlldf8
此快照首次捕获于
2024/09/06 18:53
2 年前
此快照最后确认于
2025/11/04 21:40
4 个月前
查看原帖
CPP
#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;
}

回复

4 条回复,欢迎继续交流。

正在加载回复...