| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 80226 | 石晋骁 | 数组中元素交换 | C++ | Accepted | 1 MS | 268 KB | 305 | 2024-07-11 11:44:50 |
#include<bits/stdc++.h> using namespace std; int a[101]; int main(){ int n; cin >> n; for(int i = 1;i <= n;i++){ cin >> a[i]; } int t; for(int j = 1;j< n;j = j+2){ t = a[j]; a[j] = a[j+1]; a[j+1] = t; } for(int k = 1;k<= n;k++){ cout << a[k] << " "; } return 0; }