Five-year-on-five bold drag winning Algorithm

Source: Internet
Author: User

The previous algorithm used to drag the winning algorithm from the Eleventh Five-Year shopping spree was the second, second, third, and third .... in addition, the algorithm is written a long time later. The main reason is that he calculates the amount of attention each note to determine whether to win the prize. This algorithm is used to calculate whether to win the prize first and then based on the winning situation (number in the Code and in the drag-and-drop code ). count to calculate the total number of winning bets) and drag all the code to use this algorithm. // The code is incomplete.

Package com. sscgameservice. manager. lottery. renxuan. dantuo; import java. math. bigDecimal; import com. sscgameservice. manager. lottery. lottery; import com. sscgameservice. model. lotteryBean; public class RXDTBASELottery extends Lottery {/*** optional bold drag */private int q; // Number of two q values h Two q = 2 h = 2 private int h; public void setQ (int q) {this. q = q;} public void setH (int h) {this. h = h ;}// calculate the number of winning bets <span style = "font -Family: Arial, Helvetica, sans-serif "> strBuy is a symbolic link between the lottery numbers </span> private BigDecimal jisuanZhuShu (String [] danMa, String [] tuoMa, string strBuy) {int FlagDM = 0; int FlagTM = 0; for (String string: tuoMa) {if (strBuy. indexOf (string. replace ("",""))! =-1) {FlagTM ++ ;}for (String string: danMa) {if (strBuy. indexOf (string. replace ("",""))! =-1) {FlagDM ++ ;}// if (FlagDM + FlagTM >=h & FlagTM >=1 & FlagDM >=1 & danMa. length-FlagDM <= q-h) {// winning int zhushu = 1; if (h! = 5) {for (int I = FlagTM; I> 1; I --) {zhushu * = I;} for (int I = FlagTM-(h-FlagDM ); i> 1; I --) {zhushu/= I;} for (int I = h-FlagDM; I> 1; I --) {zhushu/= I ;}} return new BigDecimal (zhushu); // Number of winning tickets} else {// No winning} return new BigDecimal ("0 ");}}

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.