Basic (yuck)
This commit is contained in:
parent
4ac4bc6a58
commit
14db0c5ff0
22
basic/2015/1/problem.bas
Normal file
22
basic/2015/1/problem.bas
Normal file
@ -0,0 +1,22 @@
|
||||
OPEN 1, "../data/2015/1/input.txt", "r"
|
||||
LINE INPUT #1 file$
|
||||
|
||||
f=0
|
||||
for a=1 to len(file$)
|
||||
c$ = mid$(file$, a, 1)
|
||||
if (c$ == "(") f = f + 1
|
||||
if (c$ == ")") f = f - 1
|
||||
next a
|
||||
|
||||
print "Part 1: ", f
|
||||
|
||||
f = 0
|
||||
steps = 0
|
||||
for a=1 to len(file$)
|
||||
c$ = mid$(file$, a, 1)
|
||||
if (c$ == "(") f = f + 1
|
||||
if (c$ == ")") f = f - 1
|
||||
steps = steps + 1
|
||||
if (f < 0) break
|
||||
next a
|
||||
print "Part 2: ", steps
|
6
basic/bin/run
Executable file
6
basic/bin/run
Executable file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
year=$1
|
||||
day=$2
|
||||
|
||||
time yabasic ./$year/$day/problem.bas
|
Loading…
Reference in New Issue
Block a user