题解 | #序列中整数去重#
序列中整数去重
http://www.nowcoder.com/practice/6564a2f6e70f4153ad1ffd58b2b28490
#include<stdio.h>
int main()
{
int n, i, c;
int arr[1000] = { 0 };
scanf("%d", &n);
for (i = 0; i < n; i++)
{
scanf("%d", &arr[i]);
if (i >= 1)
{
for (c = 0; c <= i; c++)
{
if (arr[i] == arr[c] && c != i)
{
arr[i] = 0;
}
}
}
}
for (i = 0; i < n; i++) {
if (arr[i] != 0)
printf("%d ", arr[i]);
}
return 0;
}