Simple Sorting[上交大@2008]

Simple Sorting[上交大@2008]

// @Jobdo 上交大 2008 水题
#include < stdio.h >
#include
< stdlib.h >
#include
< algorithm >
using   namespace  std;
#define  N 1010

int  main()
{
    
int  i,n;
    
int  v[N];
    
while ( ~ scanf( " %d " , & n)){
        
for (i = 0 ;i < n;i ++ )
            scanf(
" %d " , & v[i]);
        sort(v,v
+ n);
        
if (n == 1 )
            printf(
" %d\n " ,v[ 0 ]);
        
else
        {
            printf(
" %d " ,v[ 0 ]);
            
for (i = 1 ;i < n;i ++ )
                
if (v[i] != v[i - 1 ])
                    printf(
"  %d " ,v[i]);
            printf(
" \n " );
        }
    }
// end while
     return   0 ;
}

你可能感兴趣的:(Simple Sorting[上交大@2008])