Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
9636 huangshengxuan 查找特定的值 C++ 解答错误 0 MS 252 KB 225 2023-02-15 16:58:45

Tests(0/1):


#include<bits/stdc++.h> using namespace std; int n,a[20000],x,p; int main(){ cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; } cin>>x; a[n]=x; while(a[p]!=x)p++; if(p==n)cout<<"-1"; else cout<<p; return 0; }


测评信息: