PROBLEM STATEMENT
Unit fractions are defined by having 1 in the numerator position. Any positive fraction of the
form n/d can be rewritten as a finite sum of distinct unit fractions. When n giving the sequence of fractions you subtract, in the order you
subtract them. Each should be given in the form "1/q" where q is a positive integer with no
leading zeros. In the example just given, you would return {"1/2","1/4","1/20"}
DEFINITION
Class:FractionSplit
Method:getSum
Parameters:int, int
Returns:vector
Method signature:vector getSum(int n, int d)
CONSTRAINTS
-d will be between 2 and 16 inclusive.
-n will be between 1 and d-1 inclusive.
EXAMPLES
0)
4
5
Returns: {"1/2", "1/4", "1/20" }
The example above.
1)
2
3
Returns: {"1/2", "1/6" }
1/2 is the largest unit fraction that can be subtracted from 2/3. The unit fraction 1/6 remains
after the subtraction.
2)
1
2
Returns: {"1/2" }
1/2 is the largest unit fraction you can subtract.
3)
15
16
Returns: {"1/2", "1/3", "1/10", "1/240" }
4)
14
15
Returns: {"1/2", "1/3", "1/10" }
This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2010, TopCoder, Inc. All rights reserved.