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