Home > Back-end >  To improve speed loop, vb can be c, strives for the code
To improve speed loop, vb can be c, strives for the code

Time:09-21

What other way to improve the code, to speed up the speed,
Method 1
A=Array (12, 0, 120, 5, 3, 4, 55, 37, 128, 119, 8, 15, 16, 18, 20, 55, 650, 860, 125)
For k1=1 To 6
For k2=2 To 7
For k3=3 To 8
For k4=4 To 9
For k5=5 To 10
For k6=5 To 11
B=a (k1) + a (k2) + a (k3) + a (k4) + a (k5) + a (k6)
The Debug. Print a (k1); "+". A (k2); "+". A (k3); "+". A (k4). "+". A (k5); "+". A (k6); "="; B
Next k6
Next k5
Next k4
Next k3
Next k2
Next k1
Method 2
A=Array (12, 0, 120, 5, 3, 4, 55, 37, 128, 119)
For k1=1 To 6
B=a (k1)
For k2=2 To 7
A + b=a (k2)
For k3=3 To 8
B +=a (k3)
For k4=4 To 9
A + b=a (k4)
The Debug. Print a (k1); "+". A (k2); "+". A (k3); "+". A (k4). "="; B
Next k4
Next k3
Next k2
Next k1

CodePudding user response:

You this two ways in fact is the same, in its form

CodePudding user response:

Is for combinations of
  • Related