当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3861:Royal Gems

题目描述
In the game of Royal Gems, you are given an n × m board and arbitrarily large number of ruby, emerald, sapphire, and diamond gemstones. You must put one gemstone in each cell of the board according to the following rules:

1) Every ruby has an emerald, a sapphire and a diamond in his neighbors.
2) Every emerald has a sapphire and a diamond in her neighbors.
3) Every sapphire has a diamond in his neighbors.

A neighbor of a cell is one of the four cells that are directly above, below, left, or right of the cells. Write aprogram that finds the maximum number of ruby gemstones that could be put on the board satisfying the above rules.
输入解释
There are multiple test cases in the input. Each test case consists of n (1 < n < 8) and m (1 < m < 8). The input terminates with a line containing 0 0.
输出解释
For each test case, write a single line containing the maximum number of ruby gemstones on the board.
输入样例
2 2
2 3
3 3
0 0
输出样例
0
1
2

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 Tehran 2009

源链接: POJ-3861

最后修改于 2020-10-29T07:14:01+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536