Skip to content

Instantly share code, notes, and snippets.

@wsgac
Created August 1, 2019 13:48
Show Gist options
  • Select an option

  • Save wsgac/8d4b0feb65b1c63dfc5037e830cd9080 to your computer and use it in GitHub Desktop.

Select an option

Save wsgac/8d4b0feb65b1c63dfc5037e830cd9080 to your computer and use it in GitHub Desktop.
PicoLisp solution for the Above Average problem on Kattis
# Kattis - Above Average
# https://open.kattis.com/problems/aboveaverage
(load "@lib/math.l")
(de getInput ()
(mapcar '((Row) (mapcar '((El) (read))
(range 1 (read))))
(range 1 (read))))
(de processClass (Grades)
(let (Avg (/ (apply + Grades) (length Grades))
Above (filter '((X) (> X Avg)) Grades))
(native "@" "printf" 'I "%.3f%\n" (cons (* 100 (length Above)) (length Grades)))))
# (mapc processClass (getInput))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment