文章
13
粉丝
386
获赞
2
访问
65.2k
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int N = 1000 + 10;
int a[N], b[N], n;
int main(){
while(scanf("%d", &n) != EOF){
for(int i = 0; i < n; i ++) scanf("%d", &a[i]);
sort(a, a + n);
int index = 0;
b[index++] = a[0];
for(int i = 1; i < n; i ++){
if(a[i] != a[i - 1]){
b[index++] = a[i];
}
}
for(int i = 0; i < index - 1; i++) printf("%d ", b[i]);
printf("%d\n", b[index - 1]);
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发