Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
80819 刘泽熙 18第一次出现与最后一次出现的位置 C++ Compile Error 0 MS 0 KB 233 2024-07-11 16:30:02

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int k,end,first; cin>>k; for(int i=1;i<=n;i++){ if(first==0){ first=i; end=i; } if(first==0){ cout<<-1; }else{ cout<<first<<" "<<end; } }


Run Info:

Main.cc: In function 'int main()':
Main.cc:6:17: error: 'n' was not declared in this scope
  for(int i=1;i<=n;i++){
                 ^
Main.cc:17:1: error: expected '}' at end of input
 }
 ^