Editorial for BPC 1 J2 - Cake


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.

Author: squishybanana04

Hint 1

If you divide all values in the array by a constant, they will remain proportional to one another.

Hint 2

Find the largest value you can divide by while every value stays as an integer (i.e. the GCD).

Solution

Output each value in the array, divided by the GCD of the array. Finding the GCD is as simple as testing each value less than 100 because the constraints are small, but if they were larger you could use Euclid's algorithm.


Comments

There are no comments at the moment.