/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package test;
import java.math.BigInteger;
import java.math.BigDecimal;
/**
* 2011-3-19
* @author J asper
*/
public class RedandBlue {
public static void main(String[] args) {
System.out.println("双色球中奖概率(6/33+1/16):");
BigInteger allOdds = getOdds(33,6).multiply(getOdds(16,1));
BigInteger odds1 = getOdds(6,6).multiply(getOdds(1,1));
BigInteger odds2 = getOdds(6,6).multiply(getOdds(15,1));
BigInteger odds3 = getOdds(6,5).multiply(getOdds(27,1)).multiply(getOdds(1,1));
BigInteger odds4 = getOdds(6,5).multiply(getOdds(27,1)).multiply(getOdds(15,1)).add(getOdds(6,4).multiply(getOdds(27,2)).multiply(getOdds(1,1)));
BigInteger odds6 = getOdds(6,2).multiply(getOdds(27,4)).multiply(getOdds(1,1)).add(getOdds(6,1).multiply(getOdds(27,5)).multiply(getOdds(1,1))).add(getOdds(27,6).multiply(getOdds(1,1)));
BigInteger odds1_7 = odds1.add(odds2).add(odds3).add(odds4).add(odds5).add(odds6);
BigInteger odds7 = allOdds.add(odds1_7.negate());
String odds11 = BigDecimal.valueOf(odds1.longValue()).divide(BigDecimal.valueOf(allOdds.longValue()),8,BigDecimal.ROUND_HALF_EVEN).toPlainString();
String odds21 = BigDecimal.valueOf(odds2.longValue()).divide(BigDecimal.valueOf(allOdds.longValue()),8,BigDecimal.ROUND_HALF_EVEN).toPlainString();
String odds31 = BigDecimal.valueOf(odds3.longValue()).divide(BigDecimal.valueOf(allOdds.longValue()),8,BigDecimal.ROUND_HALF_EVEN).toPlainString();
String odds41 = BigDecimal.valueOf(odds4.longValue()).divide(BigDecimal.valueOf(allOdds.longValue()),4,BigDecimal.ROUND_HALF_EVEN).toPlainString();
String odds51 = BigDecimal.valueOf(odds5.longValue()).divide(BigDecimal.valueOf(allOdds.longValue()),4,BigDecimal.ROUND_HALF_EVEN).toPlainString();
String odds61 = BigDecimal.valueOf(odds6.longValue()).divide(BigDecimal.valueOf(allOdds.longValue()),4,BigDecimal.ROUND_HALF_EVEN).toPlainString();
String odds71 = BigDecimal.valueOf(odds7.longValue()).divide(BigDecimal.valueOf(allOdds.longValue()),4,BigDecimal.ROUND_HALF_EVEN).toPlainString();
double check=(new Double(odds11))+(new Double(odds21))+(new Double(odds31))+(new Double(odds41))+(new Double(odds51))+(new Double(odds61))+(new Double(odds71));
System.out.println("一等奖(中6+1)中奖概率:"+odds1+"/"+allOdds+"="+odds11);
System.out.println("二等奖(中6+0):"+odds2+"/"+allOdds+"="+odds21);
System.out.println("三等奖(中5+1)(3000元)中奖概率:"+odds3+"/"+allOdds+"="+odds31);
System.out.println("四等奖(中5+0或4+1)(200元)中奖概率:"+odds4+"/"+allOdds+"="+odds41);
System.out.println("五等奖(中4+0或3+1)(10元)中奖概率:"+odds5+"/"+allOdds+"="+odds51);
System.out.println("六等奖(中2+1或1+1或0+1)(5元)中奖概率:"+odds6+"/"+allOdds+"="+odds61);
System.out.println("不中奖概率:"+odds7+"/"+all