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

建议使用的浏览器:

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

2185:Milking Grid

题目描述
Every morning when they are milked, the Farmer John's cows form a rectangular grid that is R (1 <= R <= 10,000) rows by C (1 <= C <= 75) columns. As we all know, Farmer John is quite the expert on cow behavior, and is currently writing a book about feeding behavior in cows. He notices that if each cow is labeled with an uppercase letter indicating its breed, the two-dimensional pattern formed by his cows during milking sometimes seems to be made from smaller repeating rectangular patterns.

Help FJ find the rectangular unit of smallest area that can be repetitively tiled to make up the entire milking grid. Note that the dimensions of the small rectangular unit do not necessarily need to divide evenly the dimensions of the entire milking grid, as indicated in the sample input below.

输入解释
* Line 1: Two space-separated integers: R and C

* Lines 2..R+1: The grid that the cows form, with an uppercase letter denoting each cow's breed. Each of the R input lines has C characters with no space or other intervening character.
输出解释
* Line 1: The area of the smallest unit from which the grid is formed
输入样例
2 5
ABABA
ABABA
输出样例
2
提示
The entire milking grid can be constructed from repetitions of the pattern 'AB'.

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

题目来源 USACO 2003 Fall

源链接: POJ-2185

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

共提交 0

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