Egyptian Fractions in C
问题 The ancient Egyptians only used fractions of the form 1/n so any other fraction had to be represented as a sum of such unit fractions and, furthermore, all the unit fractions were different! What is a good method to make any fraction an egyptian fraction (the less sums better) in C or java, what algorithm can be used, branch and bound, a*? for example: 3/4 = 1/2 + 1/4 6/7 = 1/2 + 1/3 + 1/42 回答1: One way is the greedy algorithm. Given the fraction f , find the largest Egyptian fraction 1/n