| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 153656 | 万骏博 | 指针遍历数组II | C++ | Wrong Answer | 1 MS | 268 KB | 279 | 2026-05-23 17:03:48 |
#include<bits/stdc++.h> using namespace std; int a,b[101],c; int main(){ cin>>a; for(int i=1;i<=a;i++){ cin>>b[i]; } int *p=&b[1]; for(int i=0;i<a;i++){ if(*(p+i)%2==0){ cout<<*(p+i-1)<<" "; } else{ cout<<*(p+i+1)<<" "; } } return 0; }
------Input------
5 1 2 3 4 5
------Answer-----
2 1 4 3 6
------Your output-----
2 1 4 3 0