2024 day 7

This commit is contained in:
Dimitri Lozeve 2024-12-07 13:17:15 +01:00
parent 6a4ae2dd99
commit 7dc480d68f
3 changed files with 875 additions and 0 deletions

16
2024/day07/day07.bqn Normal file
View file

@ -0,0 +1,16 @@
Split((-˜+`׬)=)
in˘•ParseFloat¨¨01(¨)˘>' 'Split¨¨':'Split¨•FLines"input"
Check1{
𝕨𝕊n: 𝕨=n;
0=(𝕩)|𝕨 ? ((𝕨÷𝕩)𝕊1𝕩)(𝕨-𝕩)𝕊1𝕩 ; (𝕨-𝕩)𝕊1𝕩
}
•Show +´˘/in Check1´˘in
Unconcat{(𝕨-𝕩)÷10•Repr𝕩}
Suffix{0=(10•Repr𝕩)|𝕨-𝕩}
Check2{
𝕨𝕊n: 𝕨=n;
𝕨Suffix𝕩 ? ((𝕨Unconcat𝕩)𝕊1𝕩)((𝕨÷𝕩)𝕊1𝕩)(𝕨-𝕩)𝕊1𝕩 ;
0=(𝕩)|𝕨 ? ((𝕨÷𝕩)𝕊1𝕩)(𝕨-𝕩)𝕊1𝕩 ; (𝕨-𝕩)𝕊1𝕩
}
•Show +´˘/in Check2´˘in