今天运气不错,想买注彩票,大致算了下花2块买七星彩平均能中多少钱
static void ticket() {//1234567long first = 5000000;//7long second = 500000;//6long third = 1800;//5long fourth = 300;//4long fifth = 20;//3long sixth = 5;//2long 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元,算了吧,买跟老冰棍不香嘛