提交时间:2019-11-26 21:28:16

运行 ID: 2474

#include<iostream> using namespace std; int main(){ int n,a[1000],b[1000],c[1000],i,j=1,k=1; cin>>n; for(i=1;i<=n;i++){ cin>>a[i]; if(a[i]%2==0){ b[j]=a[i]; j++; }else{ c[k]=a[i]; k++; } } for(i=1;i<j;i++) cout<<b[i]<<" "; cout<<endl; for(i=1;i<k;i++) cout<<c[i]<<" "; return 0; }