ZOJ 3212: K-Nice
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ZOJ 3212: 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的主要内容,如果未能解决你的问题,请参考以下文章
BZOJ3212: Pku3468 A Simple Problem with Integers
bzoj3212: Pku3468 A Simple Problem with Integers(线段树)
bzoj 3212 Pku3468 A Simple Problem with Integers