///@author Sycamore, ZJNU ///@date 2017-02-09 #include<iostream> #include<algorithm> using namespace std; int mat[15][15]; int main() { int T, M, N, k; cin >> T; while (T--) { cin >> N >> M >> k; fill(*(mat + 1), *(mat + 15) + 15, 1); if (k == 0) { for (int i = 0; i<N; i++) for (int j = 0; j < M; j++) { cout << 1 << (j == M - 1 ? ‘\n‘ : ‘ ‘); } continue; } if (k % (M - 2) == 0)fill(*(mat + 1), *(mat + k / (M - 2) + 1) + 15, 0); else { fill(*(mat + 1), *(mat + k / (M - 2) + 1) + 15, 0); for (int i = 0; i <= k % (M - 2); i++) { mat[k / (M - 2) + 2][i] = 0; } } for (int i = 0; i<N; i++) for (int j = 0; j < M; j++) { cout << mat[i][j] << (j == M - 1 ? ‘\n‘ : ‘ ‘); } } return 0; }
pasting
时间: 2024-10-07 11:14:11