Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
80812 胡盛哲 18第一次出现与最后一次出现的位置 C++ Compile Error 0 MS 0 KB 276 2024-07-11 16:28:38

Tests(0/0):


Code:

#include <iostream> using namespace std; int main(){ int n; cin >> n; for(int i=1;i<=n;i++){ if(a[i]==k){ if(first==0){ first = i; } end = i; } } if(first==0){ cout <<-1; } else{ cout <<first<< ' ' <<endl; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:7:9: error: 'a' was not declared in this scope
      if(a[i]==k){
         ^
Main.cc:7:15: error: 'k' was not declared in this scope
      if(a[i]==k){
               ^
Main.cc:8:10: error: 'first' was not declared in this scope
       if(first==0){
          ^
Main.cc:11:8: error: overloaded function with no contextual type information
    end = i;
        ^
Main.cc:14:5: error: 'first' was not declared in this scope
  if(first==0){
     ^
Main.cc:19:2: error: expected '}' at end of input
  }
  ^