提交时间:2019-11-25 17:58:56
运行 ID: 2429
#include<iostream> int main(){ int shu[101]={0}; int ji[101]={0}; int ou[101]={0}; int n; scanf("%d",&n); for(int a=1;a<=n;a++){ scanf("%d",&shu[a]); }//保存shu for(int a=1,b=1,c=1;a<=n;a++){ if(shu[a]%2==0){ ji[b]=shu[a]; b++; } if(shu[a]%2==1){ ou[c]=shu[a]; c++; } }//奇偶数存储 for(int c=1;c<=n;c++){ if(ou[c]!=0) printf("%d ",ou[c]); } printf("\n"); for(int b=1;b<=n;b++){ if(ji[b]!=0) printf("%d ",ji[b]); } return 0; }