题解 | #序列中整数去重#
序列中整数去重
https://www.nowcoder.com/practice/6564a2f6e70f4153ad1ffd58b2b28490
void sortedDel(int n) { int count = 0; int arr[100] = { 0 }; for (int i = 0; i < n; i++) { scanf("%d", &arr[i]); } for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (arr[i] == arr[j]) { arr[j] = ' '; } } if (arr[i] != ' ') { printf("%d ", arr[i]); } } } int main() { int n = 0; scanf("%d", &n); sortedDel(n); return 0; }