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

建议使用的浏览器:

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

2458:Rigging the Bovine Election

题目描述
It's election time. The farm is partitioned into a 5x5 grid of cow locations, each of which holds either a Holstein ('H') or Jersey ('J') cow. The Jerseys want to create a voting district of 7 contiguous (vertically or horizontally) cow locations such that the Jerseys outnumber the Holsteins. How many ways can this be done for the supplied grid?
输入解释
* Lines 1..5: Each of the five lines contains five characters per line, each 'H' or 'J'. No spaces are present.
输出解释
* Line 1: The number of distinct districts of 7 connected cows such that the Jerseys outnumber the Holsteins in the district.
输入样例
HHHHH
JHJHJ
HHHHH
HJHHJ
HHHHH
输出样例
2
提示
OUTPUT DETAILS:
The two possible districts are:
.....                .....

JHJHJ JHJHJ
....H and .H...
....J .J...
..... .....

Any other possible district with seven cows has fewer than 4 Jerseys.

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

源链接: POJ-2458

最后修改于 2020-10-29T06:33:00+00:00 由爬虫自动更新

共提交 0

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