2019-02: 1202 Program Alarm
Part 1
Part 2
breakFlag <- FALSE
for (i in 0:99) {
for (j in 0:99) {
dt <- dtM
dt[1 + 1] <- i
dt[2 + 1] <- j
d <- 0
x <- 1
while (d != 99) {
if (dt[x] == 1) {
dt[dt[x + 3] + 1] <- dt[dt[x + 1] + 1] + dt[dt[x + 2] + 1]
}
else if (dt[x] == 2) {
dt[dt[x + 3] + 1] <- dt[dt[x + 1] + 1] * dt[dt[x + 2] + 1]
}
x <- x + 4
d <- dt[x]
}
if (dt[1] == 19690720) {
breakFlag <- TRUE
break
}
}
if (breakFlag) { break }
}
100 * dt[1 + 1] + dt[2 + 1]
[1] 8609