今天运气不错,想买注彩票,大致算了下花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元,算了吧,买跟老冰棍不香嘛
