Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
2394 莫业祁 序列变换 C++ Compile Error 0 MS 0 KB 334 2023-12-30 12:55:03

Tests(0/0):


Code:

# include<iostream> using namespace std; int main(){ int n,temp1=0,temp2=0; cin>>n; int a[n],b[n]=1; for(int i=0;i<n;i++) cin>>a[i]; for(int i=1;i<n;i++){ temp1=a[i]; temp2=a[temp1-1]; b[i]=temp2; } for(int i=0;i<n;i++) cout<<b[i]<<" "; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:7:19: error: variable-sized object 'b' may not be initialized
     int a[n],b[n]=1;
                   ^