fork download
  1. (defn easy-148
  2. [[N frst scnd thrd]]
  3. (let [n-2x (* 2 N)
  4. move-to-frst (if (= (mod frst N) 0)
  5. n-2x
  6. (+ n-2x frst))
  7. scnd-minus-N (- N scnd)
  8. move-to-scnd (if (= (mod (+ scnd-minus-N frst) N) 0)
  9. (+ N frst)
  10. (+ scnd-minus-N frst N))
  11. scnd-min-thrd (Math/abs (- scnd thrd))
  12. move-to-thrd (if (zero? scnd-min-thrd)
  13. N
  14. (Math/abs scnd-min-thrd))]
  15. (+ move-to-frst move-to-scnd move-to-thrd)))
  16.  
  17. (println (easy-148 '(5 1 2 3)))
Success #stdin #stdout 1.52s 389120KB
stdin
Standard input is empty
stdout
21