Files
2026-06-15 09:00:38 +08:00

19 lines
451 B
C

#include <stdio.h>
#include <stdbool.h>
#define SIZE 10
int main() {
int arr[SIZE] = {2, 5, 3, 5, 1, 2, 6, 7, 8, 9};
bool used[SIZE] = {false}; // 用于标记数字是否已被使用
for (int i = 0; i < SIZE; ++i) {
if (!used[arr[i]]) { // 检查当前值是否已被使用
printf("First occurrence of %d\n", arr[i]);
used[arr[i]] = true; // 标记该值为已使用
}
}
return 0;
}