Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Module Main
- Public Function Main(ByVal Args() As String)As Integer
- ' Индекс элемента
- Dim i As Integer
- ' Отсортировать список
- Dim q As New LinkedList(Of Integer)(Enumerable.Range(1, 17))
- ' Квадраты 4 9 16 25
- Dim f = Enumerable.Range(2, 4).Select(Function (x As Integer) x * x).ToArray
- ' Количество ложных совпадений
- Dim FalseCount As Integer
- Do
- If f.Contains(q(i) + q(i + 1)) Then
- i += 1
- FalseCount = 0
- Else
- Dim d As Integer = q(i+1)
- q.Remove(d)
- q.AddLast(d)
- FalseCount += 1
- If FalseCount > q.Count Then
- i = 0
- FalseCount = 0
- d = q(0)
- q.RemoveFirst()
- q.AddLast(d)
- End If
- End If
- Loop Until i >= q.Count - 2 ' Идти до тех пор, пока не превысим коллекцию -2 элемента
- For Each i In q
- Console.Write(i & " ")
- Next
- Return 0
- End Function
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement