| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
那位大牛给看看,错哪里了呀,能给几组大的数据也行#include<stdio.h>
int a[3001],next[3001],b[3001];
int main()
{
int n,n1,n0,i,j,k;
while(scanf("%d",&n)!=EOF)
{ n1=0; n0=0;
for(i=0;i<n;i++)
{ scanf("%d",&a[i]);
if(a[i]==1) n1++;
else n0++;
}
i=0; j=n0;
for(k=0;k<n;k++)
{ if(a[k]==0) next[i++]=k;
else next[j++]=k;
}
//for(i=0;i<n;i++)
//printf("%d ",next[i]);
for(i=0;i<n-1;i++)
printf("%d ",a[next[i]]);
printf("%d\n",a[next[n-1]]);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator