include stdafx include math include iostream using namespace std void

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "stdafx.h"
//#include "math.h"
#include <iostream>
using namespace std;
void f (int * a, int n)
{ int k;
for (int i=0;i<n;i++)
{ k=0;
if (a[i]!=0)
for (int j=0;j<n;j++)
if ((a[i]==a[j]) && (i!=j)) { a[j]=0;
k=1;}
if (k) a[i]=0;
}
}
void main()
{ int n;
cin>>n;
int* a= new int [n];
for(int i=0;i<n;i++)
cin>>a[i];
f(a,n);
for(int i=0;i<n;i++)
cout<<a[i]<<' ';
delete []a;
}