分类: C/C++
2011-05-30 23:16:40
#include
#define N 50
#define k 10
int str[4],block[k];
void deal(int str[],int block[],int n,int m)
{
int j,i,d,a=0,temp[k];
for(j=0;j
for(i=0;i
goto end;
if(j
else
{
for(d=0;d
for(i=j;i
{
temp[d]=i;
break;
}
if(i>=n)
temp[d]=n+1;
}
for(i=0;i
{
temp[0]=temp[i];
a=i;
}
block[a]=str[j];
}
end:;
if(j
printf("%3d",block[i]);
else
for(i=0;i
printf("\n");
}
}
void main()
{
int i,count,p;
printf("请输入页面的总数目:");
scanf("%d",&count);
printf("请输入页面:");
for(i=0;i
printf("请输入物理块数目:");
scanf("%d",&p);
deal(str,block,count,p);
}