Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
120969 | 石茂诤 | 指针遍历数组II | C++ | Accepted | 1 MS | 268 KB | 361 | 2025-06-02 16:52:21 |
#include<bits/stdc++.h> using namespace std; int a,b[100]; int main(){ int *t,n; cin>>n; //Ï൱ÓÚt=&b[0],Ö¸ÏòÊý×éÊ×ÔªËØµÄµØÖ· //cout<<*t<<endl; for ( int i = 1 ;i <=n ; i ++ ){ cin>>b[i]; } t=b; for(int i=1;i<=n;i++){ *t++; if(*t%2==0)*t-=1; else *t+=1; cout<<*t<<" "; } // cout<<*(t+1); return 0; }