Skip to content

Instantly share code, notes, and snippets.

@snowmerak
Last active April 4, 2022 07:08
Show Gist options
  • Save snowmerak/0dbaddb90a0f87595b47cb8a627b8a13 to your computer and use it in GitHub Desktop.
Save snowmerak/0dbaddb90a0f87595b47cb8a627b8a13 to your computer and use it in GitHub Desktop.
(ns prac.core
(:require [clojure.string :as str]))
(defn -main []
(let [[x c] (as-> (read-line) a
(str/split a #" ")
(map #(Integer. %) a))
l (as-> (for [_ (range x)]
(Double. (read-line))) a
(sort a)
(drop c a)
(drop-last c a))]
(println (format "%.2f" (/ (reduce + l) (count l))))
(println (format "%.2f" (/ (+ (* (first l) c) (* (last l) c) (reduce + l)) (+ c c (count l)))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment