1. 程式人生 > >ZOJ 3212: K-Nice

ZOJ 3212: K-Nice

auth span rda ref gre ice spa include ++

K-Nice

[email protected] Sycamore, ZJNU
[email protected] 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

ZOJ 3212: K-Nice