题目地址


#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
const int MAXN=1e3;
int a[MAXN];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	sort(a+1,a+n+1);
	int m=unique(a+1,a+n+1)-a-1;
	printf("%d\n",m);
	for(int i=1;i<=m;i++){
		printf("%d ",a[i]);
	}
	printf("\n");
	return 0;
}