买一注彩票平均中奖的金额

今天运气不错,想买注彩票,大致算了下花2块买七星彩平均能中多少钱

static void ticket() {
        //1234567
        long first = 5000000;//7
        long second = 500000;//6
        long third = 1800;//5
        long fourth = 300;//4
        long fifth = 20;//3
        long sixth = 5;//2
        long total = (long) Math.pow(10, 7);
        double sum = 0;
        sum += 1f / total * first;
        sum += (2f / total) * second;
        sum += (3f / total) * third;
        sum += (4f / total) * fourth;
        sum += (5f / total) * fifth;
        sum += (6f / total) * sixth;
        System.out.println(total);
        System.out.println(sum);
    }
10000000
0.6006730015315043

平均一注2块,能中0.6元,算了吧,买跟老冰棍不香嘛

猜你喜欢

转载自blog.csdn.net/jerry872235631/article/details/107128075
今日推荐