#include<iostream> using namespace std; int main() { int a[15][10]; int b[5][5]; int co[4][3]; int count; int len, wid; int oriy; int dis; int height[4] = { 0,0,0,0 }; int leftmargin; int max = 15; int i, j, k; int tmp; int x, y; bool block=false; for (i = 0; i<15; i++) for (j = 0; j<10; j++) cin >> a[i][j]; leftmargin = 3; b[0][4] = b[1][4] = b[2][4] = b[3][4] = b[4][0] = b[4][1] = b[4][2] = b[4][3] = 0; for (i = 0; i<4; i++) { for (j = 0; j<4; j++) { cin >> b[i][j]; if (b[i][j] == 1 && j < leftmargin) leftmargin = j; } } for (i = 0; i < 4; i++) { if (b[0][i] == 1) b[0][4]++; if (b[1][i] == 1) b[1][4]++; if (b[2][i] == 1) b[2][4]++; if (b[3][i] == 1) b[3][4]++; if (b[i][0] == 1) b[4][0]++; if (b[i][1] == 1) b[4][1]++; if (b[i][2] == 1) b[4][2]++; if (b[i][3] == 1) b[4][3]++; } len = b[4][0]; wid = b[0][4]; for (i = 0; i < 4; i++) { if (b[4][i] > len) len = b[4][i]; if (b[i][4] > wid) wid = b[i][4]; } cin >> x; y = 0; for (i = 0; i < 4; i++) { if (x >= leftmargin) { for (j = x - leftmargin; j < x - leftmargin + 4; j++) a[i][j] = b[i][j - x + leftmargin]; } else { for (j = x; j < x - leftmargin + 4; j++) a[i][j] = b[i][j - x + leftmargin]; } } for (i = 0; i < 4; i++) { for (j = x; j < x + wid; j++) { if (a[i][j] == 1) { oriy = i; break; } } if (oriy = i) break; } count = 0; for (i = 0; i < 4; i++) { if (count == 4) break; for (j = x; j < x + wid; j++) { if (a[i][j] == 1) { co[count][0] = j; co[count][1] = i; if (a[i + 1][j] == 1) co[count][2] = 1; else co[count][2] = 0; count++; } } } for (i = 0; i < 15; i++) { for (k = 0; k < 4; k++) { cout << "k" << k << " "; if (co[k][2] != 1) { cout << "cok1" << co[k][1] << "cok0" << co[k][0] << endl; if (a[co[k][1] + 1][co[k][0]] == 1 || co[k][1] == 14) { block = true; break; } } } if (block) break; else { for (j = 0; j < 4; j++) a[co[j][1]][co[j][0]] = 0; for (j = 0; j < 4; j++) co[j][1]++; for (j = 0; j < 4; j++) a[co[j][1]][co[j][0]] = 1; } } for (i = 0; i < 15; i++) { for (j = 0; j < 10; j++) { cout << a[i][j] << " "; } cout << endl; } system("pause"); return 0; }