数列有序!
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 45490 Accepted Submission(s): 19723
3 3 1 2 4 0 0
1 2 3 4
#include<stdio.h>
int main()
{
int n,m,i,a[110],b[110];
while(scanf("%d%d",&n,&m)!=EOF&&(m!=0||n!=0))
{
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
if(a[i]<m)
printf("%d ",a[i]);
else
break;
}
printf("%d",m);
for(;i<n;i++)
{
printf(" %d",a[i]);
}
printf("\n");//puts("");
}
return 0;
}
//意m插入的怎样插入并排序
//注巧妙以及m插入前后空格处理的巧妙