Last active
April 4, 2022 07:08
-
-
Save snowmerak/0dbaddb90a0f87595b47cb8a627b8a13 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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