Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
148568 李昱龙 数组中元素交换 C++ Accepted 1 MS 268 KB 280 2026-02-26 11:10:10

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; int a[105]; int t,n; int main() { cin>>n; for(int s=1;s<=n;s++){ cin>>a[s]; } for(int i=1;i<n;i=i+2){ t = a[i]; a[i]=a[i+1]; a[i+1]=t; } for(int g=1;g<=n;g++){ cout<<a[g]<<" "; } return 0; }