Cita de: Lekim en 25 Marzo 2016, 20:04 PM
Chacho has repetido números:
{2, 6, 10, 11, 17, 20, 24, 34, 38, 39, 40, 41, 41, 42, 43, 44, 45, 46, 47, 50}
Quita ese número repetido (41)y verás que te salen 969 XDCódigo (vbnet) [Seleccionar]Dim Elementos As IEnumerable(Of Integer) = {2, 6, 10, 11, 17, 20, 24, 34, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 50}
Dim EleX As Integer = 0
Dim EleX2 As Integer = 0
ListBox1.Items.Clear() 'Limpia el ListBox
For I1 As Integer = 0 To Elementos.Count - 1 : EleX += 1
For I2 As Integer = EleX To Elementos.Count - 1
For I3 As Integer = EleX To Elementos.Count - 1
If Elementos(I2) <> Elementos(I3) And Elementos(I3) > Elementos(I2) Then
ListBox1.Items.Add(String.Format("{0:00}, {1:00}, {2:00}", Elementos(I1), Elementos(I2), Elementos(I3)))
End If
Next
Next
Next
MessageBox.Show("Combinaciones: " & ListBox1.Items.Count)
19!
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ = 969
3!·(19 - 3)!
Ya sabes las prisas jejjejeje pero si resta no ? y deja solo únicos, ya no veo de tanto estar pegado al monitor
luis