Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
160086 王顺煜 数组中元素交换 C++ Compile Error 0 MS 0 KB 298 2026-09-12 14:44:42

Tests(0/0):


Code:

#nclude<bits/stdc++.h> using namespace std; int main(){ long long n,a[101]; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } for(int i=1;i<=n-1;i+2){ long long temp=a[i]; a[i]=a[i+i]; a[i+i]=temp; } for(int i=1;i<n;i++){ cout<<a[i]<<" "; } cout<<a[n]; }


Run Info:

Main.cc:1:2: error: invalid preprocessing directive #nclude
 #nclude
  ^
Main.cc: In function 'int main()':
Main.cc:5:3: error: 'cin' was not declared in this scope
   cin>>n;
   ^
Main.cc:9:23: warning: for increment expression has no effect [-Wunused-value]
   for(int i=1;i<=n-1;i+2){
                       ^
Main.cc:15:4: error: 'cout' was not declared in this scope
    cout<