| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 61092 | 余慕涵 | 18查找该数出现的位置 | C++ | Accepted | 1 MS | 276 KB | 471 | 2023-12-01 20:27:05 |
#include <iostream> #include <cstdio> #include <cmath> using namespace std; int main(){ int r,l=0,o,m=0,n,f; cin>>o; int a[o+1]; for(r=1;r<o+1;r++) cin>>a[r]; cin>>n; for(r=1;r<=o;r++){ if(a[r]==n){ l=r; break;}} for(r=1;r<=o;r++){ if(a[r]==n) f=r;} if(l>=1) cout<<l<<" "<<f; else cout<<-1; return 0; }