题解 | #找x#
找x
https://www.nowcoder.com/practice/069e2130430c41229ab25e47fa0949a6
#include <stdio.h> int main() { int n; while ((scanf("%d", &n)) != EOF) { int m = n; int Arr[n]; int i = 0; Arr[n] = -1; while (n--) { scanf("%d", &Arr[i++]); } int number; scanf("%d", &number); int j; for (j = 0; j < m; j++) { if (Arr[j] == number) { printf("%d\n", j); break; } } if (j == m) { printf("-1\n"); } } return 0; }