HBC51006小圆前辈的排列组合,筛法,数论Milking Grid题解

冷默言语 算法基础篇 59 0
想要检验自己的编程水平?来试试全网最全C++题库,让您在挑战中不断进步。
Every morning when they are milked, the Farmer John's cows form a rectangular grid that is R rows by C 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.

Every morning when they are milked, the Farmer John's cows form a rectangular grid that is R (1≤R≤10,000)(1 leq R leq 10,000)(1≤R≤10,000) rows by C (1≤C≤75)(1 leq C leq 75)(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.

HBC51006小圆前辈的排列组合,筛法,数论Milking Grid题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)

标签: HBC51006小圆前辈的排列组合 筛法 数论Milking Grid题解