using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Windows.Forms;
using
System.Threading;
namespace
gamePop
{
public partial class Form1 :
Form
{
public
Form1()
{ InitializeComponent(); }
private void button1_Click(object sender, EventArgs
e)
{
Thread t = new Thread(new ThreadStart
(Calculate));
t.Start(); }
void
Calculate()
{
int
MAX = 147483647;
//931322574615478515625 Math.Pow(5, 30);
List<int> counts = new List<int
>();
List<List<string>> matrixList = new List<List<string
>>();
System.Diagnostics.
Stopwatch sw = new System.Diagnostics.Stopwatch
();
sw.Start();
try
{
//init
int
currentCount = 0;
List<string> currentMatrixList = new List<string
>(MAX);
#region
for
for (int
i1 = 0; i1 < 5; i1++)
{
for (int
i2 = 0; i2 < 5; i2++)
{
for (int
i3 = 0; i3 < 5; i3++)
{
for (int
i4 = 0; i4 < 5; i4++)
{
for (int
i5 = 0; i5 < 5; i5++)
{
for (int
i6 = 0; i6 < 5; i6++)
{
for (int
i7 = 0; i7 < 5; i7++)
{
for (int
i8 = 0; i8 < 5; i8++)
{
for (int
i9 = 0; i9 < 5; i9++)
{
for (int
i10 = 0; i10 < 5; i10++)
{
for (int
i11 = 0; i11 < 5; i11++)
{
for (int
i12 = 0; i12 < 5; i12++)
{
for (int
i13 = 0; i13 < 5; i13++)
{
for (int
i14 = 0; i14 < 5; i14++)
{
for (int
i15 = 0; i15 < 5; i15++)
{
for (int
i16 = 0; i16 < 5; i16++)
{
for (int
i17 = 0; i17 < 5; i17++)
{
for (int
i18 = 0; i18 < 5; i18++)
{
for (int
i19 = 0; i19 < 5; i19++)
{
for (int
i20 = 0; i20 < 5; i20++)
{
for (int
i21 = 0; i21 < 5; i21++)
{
for (int
i22 = 0; i22 < 5; i22++)
{
for (int
i23 = 0; i23 < 5; i23++)
{
for (int
i24 = 0; i24 < 5; i24++)
{
for (int
i25 = 0; i25 < 5; i25++)
{
for (int
i26 = 0; i26 < 5; i26++)
{
for (int
i27 = 0; i27 < 5; i27++)
{
for (int
i28 = 0; i28 < 5; i28++)
{
for (int
i29 = 0; i29 < 5; i29++)
{
for (int
i30 = 0; i30 < 5; i30++)
{
#endregion
#region
geneate str
StringBuilder currentMatrixStr = new StringBuilder
();
currentMatrixStr.Append(i1); currentMatrixStr.Append(i2); currentMatrixStr.Append(i3); currentMatrixStr.Append(i4); currentMatrixStr.Append(i5); currentMatrixStr.Append(i6); currentMatrixStr.Append(i7); currentMatrixStr.Append(i8); currentMatrixStr.Append(i9); currentMatrixStr.Append(i10); currentMatrixStr.Append(i11); currentMatrixStr.Append(i12); currentMatrixStr.Append(i13); currentMatrixStr.Append(i14); currentMatrixStr.Append(i15); currentMatrixStr.Append(i16); currentMatrixStr.Append(i17); currentMatrixStr.Append(i18); currentMatrixStr.Append(i19); currentMatrixStr.Append(i20); currentMatrixStr.Append(i21); currentMatrixStr.Append(i22); currentMatrixStr.Append(i23); currentMatrixStr.Append(i24); currentMatrixStr.Append(i25); currentMatrixStr.Append(i26); currentMatrixStr.Append(i27); currentMatrixStr.Append(i28); currentMatrixStr.Append(i29); currentMatrixStr.Append(i30);
#endregion
currentCount++;
currentMatrixList.Add(currentMatrixStr.ToString());
//show count
if
(currentCount % 10000 == 0)
{ ShowText(MAX.ToString() +
"*" + counts.Count.ToString() + "+"
+ currentCount.ToString());
}
if
(currentCount == MAX)
{ counts.Add(currentCount); matrixList.Add(currentMatrixList);
//reinit
currentCount = 0;
currentMatrixList =
new List<string
>(MAX);
}
#region
end for
} } } } } } } } } } } } } } } } } } } } } } } } } } } } } }
#endregion
}
catch (Exception
ee)
{ sw.Stop(); } sw.Stop();
long
cost = sw.ElapsedMilliseconds;
}
delegate void DShowText(string
text);
void ShowText(string
text)
{
if (this
.InvokeRequired)
{
this.Invoke(new DShowText
(ShowText), text);
}
else
{
this
.Text = text;
this
.Refresh();
Application
.DoEvents();
9115

被折叠的 条评论
为什么被折叠?



