实现
#include <cstdio>
int game_graph[16][16];
int block[4][4];
int main() {
for (int i = 0;i < 15;++i) {
for (int j = 0;j < 10;++j) {
scanf("%d",&game_graph[i][j]);
}
}
for(int i = 0;i < 4;++i) {
for (int j = 0;j < 4;++j) {
scanf("%d",&block[i][j]);
}
}
int dep_col;
scanf("%d",&dep_col);
--dep_col;
int flag = 0;
for (int i = 0;i < 18; ++i) {
for (int row = 0;row < 4;++row) {
for (int col = 0;col < 4;++col) {
if (block[3 - row][col] == 1) {
if (i - row >= 0 && i - row < 15
&& game_graph[i - row][dep_col + col] == 1) {
flag = 1;
goto end;
} else if (i - row >= 0 && i - row == 14) {
flag = 2;
goto end;
}
}
}
}
end:;
if (flag!=0 && i != 0) {
if (flag == 1) {
--i;
}
for (int row = 0;row < 4;++row) {
for (int col = 0;col < 4;++col) {
if (i - row >= 0 && i - row < 15 && block[3 - row][col] == 1) {
game_graph[i - row][dep_col + col] = 1;
}
}
}
break;
}
}
for (int i = 0;i < 15;++i) {
for (int j = 0;j < 10;++j) {
printf("%d ",game_graph[i][j]);
}
printf("
");
}
}