This problem requires a straight-forward approach:
1 for(int i=0; i<n; ++i) { 2 for(int j=0; j<m; ++j) { 3 cin>>in[i][j]; 4 for(int new_i=0; new_i<x; ++new_i) 5 for(int new_j=0; new_j<x; ++new_j) 6 ans[i*x+new_i][j*x+new_j] = in[i][j]; 7 } 8 }
This problem requires a straight-forward approach:
1 for(int i=0; i<n; ++i) { 2 for(int j=0; j<m; ++j) { 3 cin>>in[i][j]; 4 for(int new_i=0; new_i<x; ++new_i) 5 for(int new_j=0; new_j<x; ++new_j) 6 ans[i*x+new_i][j*x+new_j] = in[i][j]; 7 } 8 }