Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
150839 李明秦 指针遍历数组II C++ Accepted 1 MS 280 KB 254 2026-04-01 09:48:53

Tests(2/2):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int n,a[100],*p; cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; if(a[i]%2==0){ p=&a[i]; cout<<*p-1<<" "; }else{ p=&a[i]; cout<<*p+1<<" "; } } return 0; }