| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 159337 | 谭鑫哲 | 数组中元素交换 | C++ | Accepted | 1 MS | 280 KB | 524 | 2026-08-28 10:30:20 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int n,x,m; cin>>n; int c,a[n]={}; for(c=0;c<n;c++){ cin>>a[c]; } for(c=0;c<n-1;c+=2){ m=a[c]; a[c]=a[c+1]; a[c+1]=m; } for(x=0;x<n;x++){ cout<<a[x]<<' '; } return 0; }