A day04/day04.tst => day04/day04.tst +6 -0
@@ 0,0 1,6 @@
+2-4,6-8
+2-3,4-5
+5-7,7-9
+2-8,3-7
+6-6,4-6
+2-6,4-8
A day04/day04a.bas => day04/day04a.bas +19 -0
@@ 0,0 1,19 @@
+10 OPEN "DAY04.TST" FOR INPUT AS #1
+20 LET R=0
+30 IF EOF(1) THEN 170
+40 LINE INPUT #1, L$
+50 LET C = INSTR(L$, "-")
+60 LET AL = VAL(LEFT$(L$, C-1))
+70 LET L$ = MID$(L$, C+1)
+80 LET C = INSTR(L$, ",")
+90 LET AR = VAL(LEFT$(L$, C-1))
+100 LET L$ = MID$(L$, C+1)
+110 LET C = INSTR(L$, "-")
+120 LET BL = VAL(LEFT$(L$, C-1))
+130 LET L$ = MID$(L$, C+1)
+140 LET BR = VAL(L$)
+150 IF (AL <= BL AND BR <= AR) OR (BL <= AL AND AR <= BR) THEN R = R+1
+160 GOTO 30
+170 CLOSE #1
+180 PRINT R
+190 END