码迷,mamicode.com
首页 > 其他好文 > 详细

ZOJ 3212: K-Nice

时间:2017-07-30 12:38:53      阅读:111      评论:0      收藏:0      [点我收藏+]

标签:nbsp   ffffff   tin   size   cout   pre   more   out   span   

K-Nice

 

///@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

 

ZOJ 3212: K-Nice

标签:nbsp   ffffff   tin   size   cout   pre   more   out   span   

原文地址:http://www.cnblogs.com/zjnu/p/7258660.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!