POJ 2965 The Pilots Brothers' refrigerator
Time Limit: 1000MS | Memory Limit: 65536K | |||
Total Submissions: 30872 | Accepted: 11961 | Special Judge |
Description
There are 16 handles on the refrigerator door. Every handle can be in one of two states: open or closed. The refrigerator is open only when all handles are open. The handles are represented as a matrix 4х4. You can change the state of a handle in any location [i, j] (1 ≤ i, j ≤ 4). However, this also changes states of all handles in row i and all handles in column j.
The task is to determine the minimum number of handle switching necessary to open the refrigerator.
Input
Output
Sample Input
Sample Output
【题意】
有4×4的棋盘,上面的棋子一面是黑的,一面是白的。规定翻转一个棋子的同时也要翻转它的同行同列的棋子,问给定一个棋盘的棋子状态,至少需要翻转多少个棋子,能使得所有棋子朝上都是白的。
输出最少数,然后依次输出要翻转的棋子的位置(任意一种可行方案皆可)
【分析】
除了压缩的状态不同,其余做法与POJ 1753 Flip Game(点击查看思路)完全相同。
【代码】
__EOF__

本文链接:https://www.cnblogs.com/shenben/p/10367214.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角【推荐】一下。您的鼓励是博主的最大动力!