Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
155120 邓弘锐 18第一次出现与最后一次出现的位置 C++ Compile Error 0 MS 0 KB 323 2026-05-31 15:25:58

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int a[10000]; int main(){ int n,b; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } cin>>b; int s,c; for(int i=1;i<=n;i++){ if(a[i]==b&&s==0){ s=i; } if(a[i]==b){ c=i; } } if(x==0) cout<<-1; else cout<<x<<" "<<y; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:20:5: error: 'x' was not declared in this scope
  if(x==0) cout<<-1;
     ^
Main.cc:21:21: error: 'y' was not declared in this scope
  else cout<