Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
120029 何辰熠 数组中元素交换 C++ Accepted 1 MS 272 KB 326 2025-05-24 09:18:33

Tests(10/10):


Code:

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