数组计算交集比字典快 这个代码看不懂请解析
数组计算交集比字典快这个代码看不懂请解析Sub请解析这个代码()An=[a65536].End(3).RowBn=[h65536].End(3).Rowa=Range("...
数组计算交集比字典快 这个代码看不懂请解析
Sub 请解析这个代码()
An = [a65536].End(3).Row
Bn = [h65536].End(3).Row
a = Range("a11:g" & An)
b = Range("h11:n" & Bn)
ReDim ar(1 To UBound(a), 1 To 6)
Dim c(1 To 15, 1 To 15, 1 To 15, 1 To 15, 1 To 15, 1 To 15)
For i = 1 To UBound(a)
c(a(i, 1), a(i, 2), a(i, 3), a(i, 4), a(i, 5), a(i, 6)) = 1
'这一句c(a(i, 1), a(i, 2), a(i, 3), a(i, 4), a(i, 5), a(i, 6)) = 1 究竟什么意思,有什么用
Next
For i = 1 To UBound(b)
If c(b(i, 1), b(i, 2), b(i, 3), b(i, 4), b(i, 5), b(i, 6)) = 1 Then
N = N + 1
For j = 1 To 6
ar(N, j) = b(i, j)
Next
End If
Next
[u11].Resize(N, 6) = ar
End Sub 展开
Sub 请解析这个代码()
An = [a65536].End(3).Row
Bn = [h65536].End(3).Row
a = Range("a11:g" & An)
b = Range("h11:n" & Bn)
ReDim ar(1 To UBound(a), 1 To 6)
Dim c(1 To 15, 1 To 15, 1 To 15, 1 To 15, 1 To 15, 1 To 15)
For i = 1 To UBound(a)
c(a(i, 1), a(i, 2), a(i, 3), a(i, 4), a(i, 5), a(i, 6)) = 1
'这一句c(a(i, 1), a(i, 2), a(i, 3), a(i, 4), a(i, 5), a(i, 6)) = 1 究竟什么意思,有什么用
Next
For i = 1 To UBound(b)
If c(b(i, 1), b(i, 2), b(i, 3), b(i, 4), b(i, 5), b(i, 6)) = 1 Then
N = N + 1
For j = 1 To 6
ar(N, j) = b(i, j)
Next
End If
Next
[u11].Resize(N, 6) = ar
End Sub 展开
2个回答
展开全部
数组c列出所有可能的组合,
c(a(i, 1), a(i, 2), a(i, 3), a(i, 4), a(i, 5), a(i, 6)) = 1‘a中出现的组合做上记号
If c(b(i, 1), b(i, 2), b(i, 3), b(i, 4), b(i, 5), b(i, 6)) = 1 Then’查看有没有记号
c(a(i, 1), a(i, 2), a(i, 3), a(i, 4), a(i, 5), a(i, 6)) = 1‘a中出现的组合做上记号
If c(b(i, 1), b(i, 2), b(i, 3), b(i, 4), b(i, 5), b(i, 6)) = 1 Then’查看有没有记号
追问
c(a(i, 1), a(i, 2), a(i, 3), a(i, 4), a(i, 5), a(i, 6)) = 1‘a中出现的组合做上记号
c(a(i, 1), a(i, 2), a(i, 3), a(i, 4), a(i, 5), a(i, 6)) = 1 ..........一定要1,用2,或者其它数字如何?
来自:求助得到的回答
2017-02-20
展开全部
确实 是比较快的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询