题解 | #定位查找#
定位查找
https://ac.nowcoder.com/acm/problem/22219
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,m;//ding
int ch;
while(cin>>n){
int a[100];
ch=0;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}
cin>>m;
for(int i=1;i<=n;i++){
if(a[i]==m){
ch=1;
cout<<i-1<<endl;
break;
}
}
if(ch!=1){
cout<<"No"<<endl;
}
}
return 0;
}