[NOIP2006 普及组] 明明的随机数 - 洛谷
#include<bits/stdc++.h>
using namespace std;
void bobble_sort(int*a,int len);
int main()
{int n,m;int a[100];bool b[100] ={0};cin>>n;m=n;for(int i = 0;i<n;i++){cin>>a[i];}bobble_sort(a,n);/*for(int i = 0;i<n;i++){cout<<a[i]<<" ";}*/for(int i = 0;i<n;i++){if(a[i]!=a[i+1]){b[i]= 1;}elsem--;}/*for(int i = 0;i<10;i++)cout<<b[i]<<" ";*/cout<<m<<endl;for(int i = 0;i<n;i++){while(b[i]==true){cout<<a[i]<<" ";break;}}return 0;
}
void bobble_sort(int*a,int len)
{int temp;for(int i = 0;i<len;i++)for(int j = 0;j<len-i-1;j++){if(a[j]>a[j+1]){temp=a[j];a[j]=a[j+1];a[j+1]=temp;}
}
}