随笔- 509  文章- 0  评论- 151  阅读- 22万 

2014-03-19 06:57

题目:对于8x8的棋盘,如果拿掉对角位置的两个小块儿,能否用1x2的多米诺牌拼成剩下的棋盘?

解法:不可能。且不说8x8,NxN都是不可能的。如果N是奇数,NxN-2是奇数,自然不可能用偶数的面积拼成。如果N为偶数,根据小学学过的染色问题,将1x2的骨牌染成1黑1白,那么最后拼成的棋盘肯定有31黑31白。问题是,摘掉的两个对角位置的颜色是一样的,所以得出矛盾,也不可能完成。

代码:

复制代码
1 // 6.2 There is an 8x8 chessboard, if we remove the two pieces at diagonal corners, can you cover the rest of the board with 2x1 dominoes?
2 // Answer:
3 //    It is impossible. Let's supposed it is feasible, we can color each domino into black and white halves.
4 //    When the board is completely covered, there'll be 62 1x1 squares, exactly 31 white and 31 black.
5 //    Actually the two squares removed are in same color, thus you can't turn (30, 32) into (31, 31), however you tile them up.
6 int main()
7 {
8     return 0;
9 }
复制代码

 

 posted on   zhuli19901106  阅读(318)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示