参考链接
- 参考链接
#include <iostream>
#include <vector>int N=0,K=0;int main(){std::cin>>N>>K;std::vector<std::vector<int>>input(N,std::vector<int>(N, 0));
// std::cout << N << " " << K;//接收用户输入for (int i = 0; i < N; ++i) {for (int j = 0; j < N; ++j) {int temp = 0;std::cin >> temp;input[i][j] = temp;}}//数据处理std::vector<std::vector<int>>ans(N*K,std::vector<int>(N*K,0));for (int i = 0; i < N*K; ++i) {for (int j = 0; j < N*K; ++j) {ans[i][j] = input[i/K][j/K];}}//打印输出for (int i = 0; i < N*K; ++i) {for (int j = 0; j < N*K; ++j) {std::cout << ans[i][j] << " ";}std::cout << std::endl;}return 0;
}