#include <iostream>
using namespace std;
int main(){
//输入
int a[15][10],b[4][4],m;
for(int i=0;i<15;i++)
for(int j=0;j<10;j++)
cin>>a[i][j];
for(int i=0;i<4;i++)
for(int j=0;j<4;j++)
cin>>b[i][j];
cin>>m;
m=m-1;
// 4*4的矩阵就是俄罗斯方块
/*******************************************
注:
每次都是4个小方块,所以count==4作为判断条件。
输出:
count是13个4,和最后的一个2
temp是1—13,最后的数字是13
故:
步骤1—步骤3—1-3-1-3-1-3..........完毕---单纯的执行步骤2
*******************************************/
int temp=0;
int count=0;
while(1){ //下文中是利用break 跳出while循环
//步骤1
for( int i=0;i<4;i++){
for(int j=0;j<4;j++){
if(b[i][j]==1){
if(a[i+temp][j+m]==0)count++;
}
}
}
//步骤2
if(count!=4){
for( int i=0;i<4;i++)
for( int j=0;j<4;j++)
if(b[i][j]==1)
a[i+temp-1][j+m]=1; // 此时说明不可以下移了,上一步则是最后一步可执行步骤
break;
}
//步骤3
if(count==4){
temp++;
count=0;
}
}
//输出
for(int i=0;i<15;i++){
for( int j=0;j<10;j++){
cout<<a[i][j]<<" ";
}
cout<<endl;
}
}
using namespace std;
int main(){
//输入
int a[15][10],b[4][4],m;
for(int i=0;i<15;i++)
for(int j=0;j<10;j++)
cin>>a[i][j];
for(int i=0;i<4;i++)
for(int j=0;j<4;j++)
cin>>b[i][j];
cin>>m;
m=m-1;
// 4*4的矩阵就是俄罗斯方块
/*******************************************
注:
每次都是4个小方块,所以count==4作为判断条件。
输出:
count是13个4,和最后的一个2
temp是1—13,最后的数字是13
故:
步骤1—步骤3—1-3-1-3-1-3..........完毕---单纯的执行步骤2
*******************************************/
int temp=0;
int count=0;
while(1){ //下文中是利用break 跳出while循环
//步骤1
for( int i=0;i<4;i++){
for(int j=0;j<4;j++){
if(b[i][j]==1){
if(a[i+temp][j+m]==0)count++;
}
}
}
//步骤2
if(count!=4){
for( int i=0;i<4;i++)
for( int j=0;j<4;j++)
if(b[i][j]==1)
a[i+temp-1][j+m]=1; // 此时说明不可以下移了,上一步则是最后一步可执行步骤
break;
}
//步骤3
if(count==4){
temp++;
count=0;
}
}
//输出
for(int i=0;i<15;i++){
for( int j=0;j<10;j++){
cout<<a[i][j]<<" ";
}
cout<<endl;
}
}