| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 74452 | 邓嘉瑶 | 18第一次出现与最后一次出现的位置 | C++ | Compile Error | 0 MS | 0 KB | 434 | 2024-05-25 12:03:30 |
#include<bits/stdc++.h> using namespace std; int n,sum=0,b,d; int main() { cin>>n; int a[n] ; for(int i=1; i<=n; i++) { cin>>a[i]; } int c; cin>>c; for(int i=1; i<n; i++) { if(a[i]==c){ b=i; cout<<b<<" "; break; } } for(int i=n; i>=0; i--) { if(a[i]==c){ d=i; cout<<d; break; } } for(int i=n; i>=0; i--) { if(a[i]!=c){ cout<<-1; } return 0; }
Main.cc: In function 'int main()': Main.cc:34:1: error: expected '}' at end of input } ^