【CodeForces】445A - DZY Loves Chessboard(dfs)

这是一篇关于DZY在n×m的棋盘上放置棋子的问题,棋盘中有些格子是坏的,不能放置棋子。DZY希望在所有好的格子上放置黑白棋子,条件是相同颜色的棋子不能相邻。任务是找到一种合适的放置方法。题目提供了输入格式和输出要求,并给出了一些样例解答。解决这个问题可以采用深度优先搜索(DFS)的方法,从棋盘的第一个好格子开始放置棋子。
摘要由CSDN通过智能技术生成

题目链接:点击打开链接

A. DZY Loves Chessboard
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

DZY loves chessboard, and he enjoys playing with it.

He has a chessboard of n rows and m columns. Some cells of the chessboard are bad, others are good. For every good cell, DZY wants to put a chessman on it. Each chessman is either white or black. After putting all chessmen, DZY wants that no two chessmen with the same color are on two adjacent cells. Two cells are adjacent if and only if they share a common edge.

You task is to find any suitable placement of chessmen on the given chessboard.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值