Dim mycount, ans As Integer Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Input #1, mycount For ai = 1 To mycount Line Input #1, strr strr = Split(strr, " ") times = UBound(strr) For i = 0 To times For ii = 0 To times If strr(i) = strr(ii) And i <> ii Then strr(ii) = "": strr(i) = "" Next Next
For iii = 0 To times If strr(iii) <> "" Then ans = ans + 1 Next Print #2, ans ans = 0 Next
Dim b As Boolean Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Input #1, n For i = 1 To n Line Input #1, x z = 0 m = Split(x, " ") For j = 0 To UBound(m) b = True For k = 0 To UBound(m) If m(j) = m(k) And j <> k Then b = False Next If b = True Then z = z + 1 Next Print #2, z Next Close Close End End Sub
Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Input #1, z For q = 1 To z Line Input #1, n x = Split(n) For i = 0 To UBound(x) List1.AddItem x(i) k = List1.ListCount Next For i = 0 To UBound(x) For j = 0 To UBound(x) If List1.List(i) = List1.List(j) And i <> j Then k = k - 1 Next Next Print #2, k List1.Clear k = 0 Next Close #2 Close #1 End End Sub
Dim mycount, ans As Integer
回覆刪除Private Sub Form_Load()
Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, mycount
For ai = 1 To mycount
Line Input #1, strr
strr = Split(strr, " ")
times = UBound(strr)
For i = 0 To times
For ii = 0 To times
If strr(i) = strr(ii) And i <> ii Then strr(ii) = "": strr(i) = ""
Next
Next
For iii = 0 To times
If strr(iii) <> "" Then ans = ans + 1
Next
Print #2, ans
ans = 0
Next
Close #2
Close #1
End
End Sub
Dim b As Boolean
回覆刪除Private Sub Form_Load()
Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, n
For i = 1 To n
Line Input #1, x
z = 0
m = Split(x, " ")
For j = 0 To UBound(m)
b = True
For k = 0 To UBound(m)
If m(j) = m(k) And j <> k Then b = False
Next
If b = True Then z = z + 1
Next
Print #2, z
Next
Close
Close
End
End Sub
Private Sub Form_Load()
回覆刪除Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, z
For q = 1 To z
Line Input #1, n
x = Split(n)
For i = 0 To UBound(x)
List1.AddItem x(i)
k = List1.ListCount
Next
For i = 0 To UBound(x)
For j = 0 To UBound(x)
If List1.List(i) = List1.List(j) And i <> j Then k = k - 1
Next
Next
Print #2, k
List1.Clear
k = 0
Next
Close #2
Close #1
End
End Sub