-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAoC2017_5.vb
41 lines (31 loc) · 920 Bytes
/
AoC2017_5.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Threading.Tasks
Imports System.IO
Module AoC2017_5
Sub Main()
Dim sr As New StreamReader("../../input.txt")
Dim li As New List(Of Integer)
Dim n As Integer = 0
Dim pcnt As Integer = 0
Dim second_part As Boolean = True
Dim line As String = sr.ReadLine()
While Not (line Is Nothing)
li.Add(Convert.ToInt32(line))
line = sr.ReadLine()
End While
While pcnt >= 0 AndAlso pcnt < li.Count
If second_part AndAlso li(pcnt) >= 3 Then
li(pcnt) -= 1
pcnt += li(pcnt) + 1
Else
li(pcnt) += 1
pcnt += li(pcnt) - 1
End If
n += 1
End While
System.Console.WriteLine(n)
End Sub
End Module