假设“M-N"表示除以M的余数是N (N
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/26 06:45:22
假设“M-N"表示除以M的余数是N (N
假设“M-N"表示除以M的余数是N (N
上例操作过程为:6-3(在1到40内)即为“3,9,15,21,27,33,39, 9-0(在1到40内)即为“9,18,27,36,” 10-1(在1到40内)即为:1,11,21,31,” 6-3与9-0的交集为:9,27, 6-3与10-1 的交集为:21 9-0与10-1的交集没有.现在输出“9,21,27,”
假设“M-N"表示除以M的余数是N (N
Function fc(x)
Dim dic As Object, a, b%(40), i%, j%, f, aa
For j = 1 To 40: b(j) = 0: Next j
x = Replace(x, ",", ",")
x = Replace(x, "-,", "-")
a = Split(x, ",")
For i = 0 To UBound(a) - 1
aa = Split(a(i), "-")
For j = 1 To 40
If j Mod Val(aa(0)) = Val(aa(1)) Then b(j) = b(j) + 1
Next j
Next i
f = ""
For j = 1 To 40
If b(j) > 1 Then f = f & j & ","
Next j
fc = f
End Function