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