Editorial for COCI '08 Contest 5 #2 Jabuka


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

We must find numbers of children C which divide both R and G. Each of these numbers is a possible solution – we can divide the fruit among C children so that each child gets R/C red apples and G/C green apples. To do this, we find all divisors of R (there are at most 2 \sqrt R of them) and for each of them check if it also divides G.


Comments

There are no comments at the moment.