#include<iostream> #include<algorithm> using namespace std; int a[1005]; int b[1005]; int main() { int n; int flag=0; cin>>n; int j=0; for(int i=0; i<n; i++) { int x; cin>>x; if(!b[x]) { b[x]=1; a[j++]=x; } } sort(a,a+j); cout<<j<<endl; for(int i=0; i<j; i++) cout<<a[i]<<‘ ‘; }
吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱吱
原文:https://www.cnblogs.com/jamesiaskcas/p/11884394.html