- ©«¤l
- 1
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 2
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- sp3
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2014-7-16
- ³Ì«áµn¿ý
- 2014-8-3
|
[µo°Ý] Ãö©ó°ò¦]ºtºâªk¤¤¥æ´«°ÝÃD
¤j®a¦n¡A§Ú¬Oªì¾ÇªÌ¡A¥Ø«e»Ýn¨Ï¥Î°ò¦]ºtºâªk§¹¦¨½×¤å¡A¦b¥´µ{¦¡®ÉÔ¦³¹J¨ì¥H¤U°ÝÃD¡A½Ð¨D¡A·PÁ¡C
°ÝÃD¦p¤U:
1 0 0 1
0 1 1 0
1 1 1 1 A°}¦C
0 0 0 0
1 0 0 0
0 1 0 0
0 0 1 1 A1°}¦C
0 0 0 0
0 0 0 1
0 0 1 0
1 1 0 0 A2°}¦C
0 0 0 0
A = A1+A2
¥Dn¬O A°}¦C¤¤ªºÈ¥[°_¨Ó·|¬OA1»PA2¤¤ªº©Ò¦³È¥[°_¨Ó
°}¦CªºÃö«Y¨î¦p¤U
¥ô¤@¦æ©Î¦C¤¤¡A¥[°_¨ÓªºÈ¡A A1 = A2 = A/2¡A¤]´N¬O»¡A1»PA2ªºÃä»ÚÈ·|µ¥©óA/2ªºÃä»ÚÈ¡C
¨Ò¦p»¡ ²Ä¤@¦C¤¤¡AAÁ`Ȭ°2¡AA1»PA2¤À§O¬°1
A°}¦C¤wª¾¡A·QnÂনA1»PA2 ¦ý¬O¦³ÂI¥dÃö
§Ú¥Dn·Qn±qA°}¦C¤¤ ¨D¥XA1»PA2
½d¨Ò¤¤A1»PA2¬O§Ú¦Û¤vºâ¥X¨Óªº
¦ÓA1»PA2 ªºÈ¤¶©ó0©Î1¤§¶¡¡A¦ì¸mÀH¾÷¡A¥un¦X¥G¨î¦¡
§Úªºµ{¦¡½X¦p¤U¡A½Ð¨D¤j¤jÀ°¦£¬Ý¤@¤U©Î¬O¦³§ó¦nªº·Qªk¡A·PÁÂ
Sub ¥æ´«_1()
Dim i As Integer, j As Integer, K As Integer, FF As Integer
Dim A As Single, b As Integer
Dim L() As Integer, M() As Integer, n1() As Integer
Dim n As Integer, s As Integer, d As Integer, num1 As Integer, num2 As Integer
n = 3 ' ²£«~¼Æ
d = 8 '»Ý¨DÂI
s = 4 '¨Ñ´XÂI
num1 = s
num2 = (n * d) + 1
ReDim L(num1), M(num2), n1(num2) 'L ¦C¼Æ ,M ¦æ¼Æ ,N new¦C¼Æ
For i = 1 To num1
Sheets(5).Cells(i, "Z") = Application.Sum(Range(Sheets(5).Cells(i, 1), Sheets(5).Cells(i, num2)))
Next i
For j = 1 To num2
Sheets(5).Cells(5, j) = Application.Sum(Range(Sheets(5).Cells(1, j), Sheets(5).Cells(num1, j)))
Next j
For i = 1 To num1
L(i) = Sheets(5).Cells(i, "Z") / 2
Next i
For j = 1 To num2
M(j) = Sheets(5).Cells(5, j) / 2
Next j
For i = 1 To num1
For j = 1 To num2
If Sheets(5).Cells(i, j) = 1 Then
If L(i) <> 0 Then
If M(j) <> 0 Then
Randomize
A = Rnd
If A > 0.5 Then
Sheets(5).Cells(i + 9, j) = 1
L(i) = L(i) - 1
M(j) = M(j) - 1
If L(i) = 0 Then
Exit For
End If
End If
End If
End If
End If
If j = num2 Then 'J¬°³Ì«á¤@¦æ
For FF = 1 To num2 'Á`¦æ¼Æ
n1(i) = Application.CountIf(Range(Sheets(5).Cells(i + 9, j + 1), Sheets(5).Cells(i + 9, j)), 1)
If n1(i) <> Sheets(5).Cells(i, "Z") / 2 Then
If L(i) <> 0 Then
If M(j) <> 0 Then
Sheets(5).Cells(i + 9, j) = 1
L(i) = L(i) - 1
M(j) = M(j) - 1
If L(i) = 0 Then
Exit For
End If
Else
j = j - FF
End If
End If
End If
Next FF
End If
Next j
Next i
End Sub |
|