diff --git a/Contest2020/Contest2020.dyalog b/Contest2020/Contest2020.dyalog index 119d6e3..5d83ae6 100644 --- a/Contest2020/Contest2020.dyalog +++ b/Contest2020/Contest2020.dyalog @@ -25,8 +25,16 @@ ∇ steps←{p}Steps fromTo ⍝ 2020 APL Problem Solving Competition Phase II - ⍝ Stub function for Problem 2, Task 1 - Steps - ⍝ Put your code and comments below here + ⍝ Problem 2, Task 1 - Steps + :If 0=⎕NC'p' ⍝ No left argument: same as Problem 5 of Phase I + steps←{(⊃⍵)+(-×-/⍵)×0,⍳|-/⍵}fromTo + :ElseIf p<0 + steps←(-⌊p){(⊃⍵)+(-×-/⍵)×0,(⍳⍺)×|-/⍵÷⍺}fromTo + :ElseIf p>0 + steps←p{(⊃⍵)+(-×-/⍵)×(|-/⍵)⌊⍺×0,⍳⌈(|-/⍵)÷⍺}fromTo + :ElseIf p=0 + steps←⊃fromTo + :EndIf ∇ ∇ urls←PastTasks url;r;paths