Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
99144 | 朱安然 | 数组中元素交换 | C++ | Accepted | 1 MS | 272 KB | 271 | 2024-11-24 14:14:56 |
#include<bits/stdc++.h> using namespace std; int main(){ int b; cin>>b; int a[b],t; for(int i=0;i<b;i++){ cin>>a[i]; } for(int i=0;i<b-1;i=i+2){ t=a[i]; a[i]=a[i+1]; a[i+1]=t; } for(int i=0;i<b;i++){ cout<<a[i]<<" "; } return 0; }