Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
124146 陈华仁星 数组中元素交换 C++ Wrong Answer 0 MS 204 KB 367 2025-07-11 10:03:21

Tests(1/10):


Code:

#include <cstdio> #include <algorithm> using namespace std; const int MAX=1e6; int a[MAX]; int main() { int n; scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d",&a[i]); } if(n%2==0) { for(int i=1;i<n;i+=2) { swap(a[i],a[i+1]); printf("%d %d ",a[i],a[i+1]); } } else printf("%d",a[n]); return 0; }


Run Info:

------Input------
5 81 43 69 80 80
------Answer-----
43 81 80 69 80
------Your output-----
80