Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
105601 | 王煜鑫 | 数组中元素交换 | C++ | Accepted | 1 MS | 268 KB | 244 | 2025-01-14 10:25:51 |
#include<bits/stdc++.h> using namespace std; int a[102]; int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } for(int j=1;j<n;j=j+2){ swap(a[j],a[j+1]); } for(int k=1;k<=n;k++){ cout<<a[k]<<" "; } }