Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
136735 李折曦 数组中元素交换 C++ Compile Error 0 MS 0 KB 423 2025-11-15 15:17:32

Tests(0/0):


Code:

#include <bits/stdc++.h> using namespace std; int main() { int a[1000000000000000000000000001],n; cin >> n; int a[100]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n - 1; i += 2) int temp = a[i]; a[i] = a[i + 1]; a[i + 1] = temp; } for (int i = 0; i < n; i++) { cout<<" "<<temp; } cout<<endl; return 0; }


Run Info:

Main.cc:4:11: warning: integer constant is too large for its type
     int a[1000000000000000000000000001],n;
           ^
Main.cc: In function 'int main()':
Main.cc:4:39: error: size of array 'a' is too large
     int a[1000000000000000000000000001],n;
                                       ^
Main.cc:11:13: warning: unused variable 'temp' [-Wunused-variable]
         int temp = a[i];
             ^
Main.cc:12:11: error: 'i' was not declared in this scope
         a[i] = a[i + 1];
           ^
Main.cc:13:20: error: 'temp' was not declared in this scope
         a[i + 1] = temp;
                    ^
Main.cc: At global scope:
Main.cc:15:5: error: expected unqualified-id before 'for'
     for (int i = 0; i < n; i++) {
     ^
Main.cc:15:21: error: 'i' does not name a type
     for (int i = 0; i < n; i++) {
                     ^
Main.cc:15:28: error: 'i' does not name a type
     for (int i = 0; i < n; i++) {
                            ^
Main.cc:18:2: error: 'cout' does not name a type
  cout<