#include<stdio.h>
#define INF 65535
int main()
{
int a[15][10];
int b[4][4];
int i, j;
for(i = 0; i < 15; i++ ){
for(j = 0; j < 10; j++ ){
scanf("%d",&a[i][j]);
}
}
for(i = 0; i < 4; i++ ){
for(j = 0; j < 4; j++ ){
scanf("%d",&b[i][j]);
}
}
int n;
scanf("%d",&n);
int min = INF;
int h;//初始化
int hb[4] = {-1,-1,-1,-1}, ha[4] = {15,15,15,15};
for(j = 0; j < 4; j++ ){
int k = 0;
while(k < 4){
if(b[k][j] == 1)
hb[j] = k;
k++;
}
k = 0;
while(k < 15){
if(a[k][j+n-1] == 1){
break;
}
k++;
}
hb[j] = k;
}
int index = 0;
for(i = 0; i < 4; i++ ){
if((hb[i] - ha[i]) < min){
min = hb[i]-ha[i];
index = i;
}
}
// for(i = 0; i < 4; i++)
// printf("ha = %d,hb = %d\n",ha[i],hb[i]);
// printf("min = %d index = %d\n",min,index);
for(i = 0; i < 4; i++ ){
for(j = 0; j < 4; j++ ){
if(b[i][j] == 1){
a[i+min-1][j+n-1] = 1;
}
}
}
for(int i = 0; i < 15; i++ ){
printf("%d",a[i][0]);
for(j = 1; j < 10; j++ ){
printf(" %d",a[i][j]);
}
printf("\n");
}
return 0;
}
csp 俄罗斯方块
最新推荐文章于 2023-02-20 22:12:02 发布