标题:分数

/*
 * 1/1 + 1/2 + 1/4 + 1/8 + 1/16 + .... 
    每项是前一项的一半,如果一共有20项,
    求这个和是多少,结果用分数表示出来。
    数学得好呀
    (2^20-1)/2^19
 */
public class demo6 {
    public static void main(String[] args) {
        work();
    }

    public static void work() {
        System.out.println((int)Math.pow(2, 20)-1 +"/"+(int)Math.pow(2, 19));
    }
}

 

posted @ 2019-10-25 20:11  hardhp74520  阅读(167)  评论(0编辑  收藏  举报