Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
105585 | 刘佳宇 | 数组中元素交换 | C++ | Accepted | 1 MS | 272 KB | 317 | 2025-01-14 10:13:10 |
#include<iostream> using namespace std; int a[1000]; int main(){ int n,c; cin>>n; for( int i=0;i<n;i++){ cin>>a[i]; } for(int j=0;j<n-1;j=j+2){ c=a[j]; a[j]=a[j+1]; a[j+1]=c; } for(int y=0;y<n;y++){ cout<<a[y]<<" "; } return 0; }