#C1445. Largest Square Garden Plot
Largest Square Garden Plot
Largest Square Garden Plot
Given the dimensions of a rectangular garden and the total number of plants planted within it, your task is to determine the side length of the largest square plot that can evenly partition the garden.
Mathematically, the answer is the greatest common divisor (GCD) of the garden's length and width. Although the total number of plants is provided as part of the input, it is not required for the computation.
The formula for the answer is given by: $$ \text{answer} = \gcd(\text{length}, \text{width}) $$
inputFormat
The input consists of three space-separated integers: length
, width
, and num_plants
. For example: 10 5 50
.
outputFormat
Output a single integer representing the side length of the largest square plot that can evenly divide the garden.## sample
10 5 50
5