| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 109264 | 方文轩 | 折半查找法 | C++ | Accepted | 100 | 1 MS | 284 KB | 277 | 2023-11-08 13:14:55 |
#include<bits/stdc++.h> using namespace std; int x[10005]; int main(){ int a; cin>>a; for(int i=1;i<=a;i++){ cin>>x[i]; } int b,ok=0; cin>>b; for(int i=1;i<=a;i++){ if(b==x[i]){ cout<<i<<endl; ok=1; } } if(!ok){ cout<<-1<<endl; } }