• 投色子下注的小程序


    /*
    投色子下注
    */
    using System;
    using System.Collections;

    namespace XXX
    {
     class MainClass
     {
      public static void Main(string[] args)
      {
       double N = 1;
       int baseline = 1;
       int count =30;//总下注次数
       DoubleN.Compute(N, baseline, count);
       for(int j = 0; j < DoubleN.tmp.Count ; j++)
       {
        Console.WriteLine("{0}\t:{1}\t==>",j,DoubleN.tmp[j]);
       }
      }
     }
     
     
     class DoubleN
     {
      public static ArrayList tmp = new ArrayList();
      public static void Compute(double N, int x, int i)
      {
       tmp.Add(N);
       tmp.Add(x * N);
       for(int j = 2; j < i + 1 ; j++)
       {
        next(x);
       }
      }

      static double next(int x)
      {
       double tmpResult = 0;
       for(int j = 0; j < tmp.Count ; j++ )
       {
        tmpResult += (double)tmp[j];
       }
       tmpResult = tmpResult * x;
       if (!tmp.Contains(tmpResult))
       {
        tmp.Add(tmpResult);
       }
       //Console.WriteLine("{0}",tmpResult);
       return tmpResult;
      }
     
     }
    }

    ------ 
    double N = 1;
       int baseline = 1;
       int count =30;//总下注次数
    0       :1      ==>
    1       :1      ==>
    2       :2      ==>
    3       :4      ==>
    4       :8      ==>
    5       :16     ==>
    6       :32     ==>
    7       :64     ==>
    8       :128    ==>
    9       :256    ==>
    10      :512    ==>
    11      :1024   ==>
    12      :2048   ==>
    13      :4096   ==>
    14      :8192   ==>
    15      :16384  ==>
    16      :32768  ==>
    17      :65536  ==>
    18      :131072 ==>
    19      :262144 ==>
    20      :524288 ==>
    21      :1048576        ==>
    22      :2097152        ==>
    23      :4194304        ==>
    24      :8388608        ==>
    25      :16777216       ==>
    26      :33554432       ==>
    27      :67108864       ==>
    28      :134217728      ==>
    29      :268435456      ==>
    30      :536870912      ==>

              double N = 2;
                int baseline = 2;
                int count = 30;
    0       :2      ==>
    1       :4      ==>
    2       :12     ==>
    3       :36     ==>
    4       :108    ==>
    5       :324    ==>
    6       :972    ==>
    7       :2916   ==>
    8       :8748   ==>
    9       :26244  ==>
    10      :78732  ==>
    11      :236196 ==>
    12      :708588 ==>
    13      :2125764        ==>
    14      :6377292        ==>
    15      :19131876       ==>
    16      :57395628       ==>
    17      :172186884      ==>
    18      :516560652      ==>
    19      :1549681956     ==>
    20      :4649045868     ==>
    21      :13947137604    ==>
    22      :41841412812    ==>
    23      :125524238436   ==>
    24      :376572715308   ==>
    25      :1129718145924  ==>
    26      :3389154437772  ==>
    27      :10167463313316 ==>
    28      :30502389939948 ==>
    29      :91507169819844 ==>
    30      :274521509459532        ==>

  • 相关阅读:
    代码块;继承;this与super关系;重载与重写对比;类的继承特点;final关键字 (Java Day08)
    变量访问;this关键字;静态;工具类;帮助文档;Math使用;Arrays使用(Java Day07)
    面向对象;类和对象;访问对象;创建对象在内存中的理解;匿名对象;封装和this (Java Day06)
    如何保证 RocketMQ 不丢失消息
    Java-String类型的参数传递问题
    图解前中后序遍历
    一文彻底理解ReentrantLock可重入锁的使用
    聊聊MySQL、HBase、ES的特点和区别
    MySQL vs Java 数据类型
    Multi-Tenancy多租户模式
  • 原文地址:https://www.cnblogs.com/bigmouthz/p/548110.html
Copyright © 2020-2023  润新知