自己写的。8/11=1/11+1/11+1/11。。。。。。
将真分数分解为埃及分数
https://www.nowcoder.com/practice/e0480b2c6aa24bfba0935ffcca3ccb7b
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); while (in.hasNextLine()) { String[] str = in.nextLine().split("\\/"); int up = Integer.valueOf(str[0]); String res = ""; for (int i = 1; i < up; i++) { res += ("1/" + str[1] + "+"); } res += ("1/" + str[1]); System.out.println(res); } } }