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