#C4050. Minimal Sprinklers Problem
Minimal Sprinklers Problem
Minimal Sprinklers Problem
You are given a garden with m rows and n columns. In this garden, a sprinkler placed appropriately will water an entire row or an entire column. Your task is to determine the minimal number of sprinklers needed so that the whole garden is watered.
It can be proven that the answer is given by the formula: \(\min(m,n)\).
Example: For a garden of size 3 rows by 4 columns, the answer is \(\min(3,4)=3\).
inputFormat
The input consists of a single line containing two space-separated integers \(m\) and \(n\) which represent the number of rows and columns of the garden, respectively.
outputFormat
Output a single integer which is the minimal number of sprinklers required to water the entire garden.
## sample3 4
3