fixed typo + re-added christmas tree

This commit is contained in:
Louis Heredero 2024-12-07 12:52:02 +01:00
parent 03063514a5
commit 9a1b3bedc2
Signed by: HEL
GPG Key ID: 8D83DE470F8544E7
4 changed files with 10 additions and 11 deletions

View File

@ -1,7 +1,7 @@
#import "/src/utils.typ": * #import "/src/utils.typ": *
#import "@preview/cetz:0.3.1": canvas, draw #import "@preview/cetz:0.3.1": canvas, draw
#let solveable(values, target) = { #let solvable(values, target) = {
if values.len() == 1 { if values.len() == 1 {
return values.last() == target return values.last() == target
} }
@ -9,7 +9,7 @@
let values = values let values = values
let v = values.pop() let v = values.pop()
if calc.rem(target, v) == 0 { if calc.rem(target, v) == 0 {
if solveable(values, target / v) { if solvable(values, target / v) {
return true return true
} }
} }
@ -17,7 +17,7 @@
return false return false
} }
return solveable(values, target - v) return solvable(values, target - v)
} }
#let solve(input) = { #let solve(input) = {
@ -29,7 +29,7 @@
target = int(target) target = int(target)
values = values.split(" ").map(int) values = values.split(" ").map(int)
if solveable(values, target) { if solvable(values, target) {
total += target total += target
} }
} }

View File

@ -5,7 +5,7 @@
return int(str(a) + str(b)) return int(str(a) + str(b))
} }
#let solveable(values, target) = { #let solvable(values, target) = {
if values.len() == 1 { if values.len() == 1 {
return values.last() == target return values.last() == target
} }
@ -13,7 +13,7 @@
let values = values let values = values
let v = values.pop() let v = values.pop()
if calc.rem(target, v) == 0 { if calc.rem(target, v) == 0 {
if solveable(values, target / v) { if solvable(values, target / v) {
return true return true
} }
} }
@ -27,7 +27,7 @@
0, 0,
str-target.len() - str-v.len() str-target.len() - str-v.len()
) )
if solveable(values, int(target2)) { if solvable(values, int(target2)) {
return true return true
} }
} }
@ -35,7 +35,7 @@
return false return false
} }
return solveable(values, target - v) return solvable(values, target - v)
} }
#let solve(input) = { #let solve(input) = {
@ -47,7 +47,7 @@
target = int(target) target = int(target)
values = values.split(" ").map(int) values = values.split(" ").map(int)
if solveable(values, target) { if solvable(values, target) {
total += target total += target
} }
} }

Binary file not shown.

View File

@ -17,7 +17,6 @@
#v(2cm) #v(2cm)
/*
#align(center, canvas({ #align(center, canvas({
draw.merge-path( draw.merge-path(
{ {
@ -50,7 +49,7 @@
fill: rgb("#63584B"), fill: rgb("#63584B"),
stroke: none stroke: none
) )
}))*/ }))
#v(1fr) #v(1fr)