技术开发 频道

投色子下注的小程序


【IT168技术文档】


/* 投色子下注 */ 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; } } }
0
相关文章