#include<iostream>
#include<vector>
using namespace std;
vector<vector<int> > init_big() {
vector<vector<int> > ans(16, vector<int>(10));
for (int i = 0;i < 15;i++) {
for (int j = 0;j < 10;j++) {
cin >> ans[i][j];
}
}
for (int j = 0;j < 10;j++) {
ans[15][j] = 1;
}
return ans;
}
vector<vector<int> > init_small() {
vector<vector<int> > ans(4, vector<int>(4));
for (int i = 0;i < 4;i++) {
for (int j = 0;j < 4;j++) {
cin >> ans[i][j];
}
}
return ans;
}
vector<vector<int> > func(vector<vector<int> > big, vector<vector<int> > small, int line, int num) {
// num即下降格数
vector<vector<int> > big_copy = big; //vector 可以通过下标方式改变值
for (int i = num;i < num + 4;i++) {
for (int j = line - 1;j < line + 3;j++) {
if(small[i - num][j - line + 1]==1)
big[i][j] = 1;
}
}
int flag = 0;
for (int i = num;i < num + 4;i++) {
for (int j = line - 1;j < line + 3;j++) {
if (small[i - num ][j - line + 1] == 1 && big[i + 1][j] == 1) {
if (i - num + 1 >= 4) {
flag = 1;
}
else if(small[i - num + 1][j - line + 1] != 1) {
flag = 1;
}
}
}
}
if (flag == 1)
return big;
else
return func(big_copy, small, line, ++num);
}
int main() {
vector<vector<int> > big = init_big();
vector<vector<int> > small = init_small();
int line;
cin >> line;
vector<vector<int> > ans = func(big, small, line, 0);
for (int i = 0;i < 15;i++) {
for (int j = 0;j < 10;j++) {
cout<< ans[i][j]<<" ";
}
cout << endl;
}
}
ccf 201604-2
最新推荐文章于 2020-08-20 18:30:09 发布