Jabuka
Mirko has R red and G green apples to share with some of his friends, so that all of them receive the same number of red apples and also the same number of green apples. Mirko does not like apples himself so he doesn't want to be left with any apples afterward. For example, if Mirko has 4 red and 8 green apples, he can divide them in three ways:
1. One friend gets all 4 red and all 8 green apples;
2. Two friends each receive 2 red apples and 4 green apples;
3. Four friends each receive 1 red and 2 green apples.
Write a program that outputs all ways for Mirko to divide his apples. Assume Mirko has an infinite supply of friends to give apples to.
each of them will receive. Each distribution needs to be output exactly once. You may output the distributions in any order.
4 8 output
1 4 8
2 2 4
4 1 2 Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.