题解 | #找x#
找x
https://www.nowcoder.com/practice/069e2130430c41229ab25e47fa0949a6
#include<iostream> #include<algorithm> using namespace std; int n,a[220]; int main() { while(scanf("%d",&n)!=EOF){ for(int i=0;i<n;i++){ scanf("%d",&a[i]); } int x,ans=-1; scanf("%d",&x); for(int i=0;i<n;i++){ if(a[i]==x) ans=i; } printf("%d",ans) ; } return 0; }