Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
131975 毛靖平 22数列变换III C++ Compile Error 0 MS 0 KB 390 2025-10-02 15:26:11

Tests(0/0):


Code:

#include <bits/stdc++.h> using namespace std; int a[105]; void move(int idx){ int tp=a[idx]; for(int i=idx;i<=n;i++){ a[i]=a[i+1]; } a[n]=tp; } int main(){ int n,max=0,k,t; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } cin>>k; while(k--){ cin>>t; move(t); } for(int i=1;i<=n;i++){ cout<<a[i]<<" "; } return 0; }


Run Info:

Main.cc: In function 'void move(int)':
Main.cc:6:19: error: 'n' was not declared in this scope
  for(int i=idx;i<=n;i++){
                   ^
Main.cc:9:4: error: 'n' was not declared in this scope
  a[n]=tp;
    ^
Main.cc: In function 'int main()':
Main.cc:12:10: warning: unused variable 'max' [-Wunused-variable]
    int n,max=0,k,t;
          ^