parent
c265199285
commit
a0bd39af16
@ -0,0 +1,23 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
int a[1001];
|
||||||
|
int i,j,t,n;
|
||||||
|
scanf("%d",&n);
|
||||||
|
for(i=0;i<n;++i)
|
||||||
|
scanf("%d",a+i);
|
||||||
|
|
||||||
|
for(i=1;i<n;++i)
|
||||||
|
{
|
||||||
|
t=a[i];
|
||||||
|
for(j=i-1;j>-1 && a[j]>t;j--)
|
||||||
|
{
|
||||||
|
a[j+1]=a[j];
|
||||||
|
a[j+1]=t;
|
||||||
|
|
||||||
|
for(j=0;j<n;++j)
|
||||||
|
printf("%-5d",a[j]);
|
||||||
|
printf("\n\n");
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in new issue