Home > Software engineering >  An array of relevant
An array of relevant

Time:10-03

Dim S (1 to 4) As String, T (1 to 100) As String, Hege As Integer
'S () of the value stored in text form, the length of the value of 1 is separated with ", "
S (1)="6,9,0,1,6" '1 and 4 are same value is "6"
S (2)="1,1,0,1,3" '1 and 2, 1 and 4, 2, and 4 values are equal,
S (3)=7, 2, 3 ", "not equal to the value of the
S (4)="6, 6" equal '
'in each of the S (N) to find a pair of equal value, if there is to write their index values at the front and the back write the remaining value of index value, into an array of T (), no child, not do any processing (fall directly, not in an array of T ()),
'such as calculated above 4 S () request the results as follows:
T (1)="1,5,2,3,4" 'this is S (1)
'because three 1 S (2), index, respectively is 1, 4-trichlorobenzene so 1-2 is a pair of; 1-4 is a pair of; 2-4 is a pair of so there will be three times the output (looking for a pair of the same value each time)
T (2)="1, 2, 3, 4, 5" 'this is S (2)
T (3)="1,4,2,3,5" 'and it is also is S (2)
T (4)="2,4,1,3,5" 'and it is also is S (2)
'because there is no subsidiary, S (3) directly next
T (5)="1, 2," 'this is S (4)
Hege=5
W 'amount of calculation, the length of S () is not fixed, some more than 100 values, therefore to seek the fastest method, thank you

CodePudding user response:

Reference
Dim S (1 to 4) As the String, T (1 to 100) As String, Hege As Integer
'S () of the value stored in text form, the length of the value of 1 is separated with ", "
S (1)="6,9,0,1,6" '1 and 4 are same value is "6"

Think about your instructions well, not chaos...

CodePudding user response:

Didn't understand your logic, clarity,,,
  • Related