2024 day 7
This commit is contained in:
parent
6a4ae2dd99
commit
7dc480d68f
3 changed files with 875 additions and 0 deletions
16
2024/day07/day07.bqn
Normal file
16
2024/day07/day07.bqn
Normal file
|
@ -0,0 +1,16 @@
|
|||
Split←((⊢-˜+`׬)∘=⊔⊢)
|
||||
in←⊑⌾⊑˘•ParseFloat¨¨0‿1⊸(↓¨)˘>' '⊸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
|
Loading…
Add table
Add a link
Reference in a new issue