src/problems/iev.lisp @ dbd94aef5f92

SETO
author Steve Losh <steve@stevelosh.com>
date Fri, 20 Dec 2019 17:12:23 -0500
parents 474d88a2af2e
children 2735aa6aab79
(in-package :rosalind)

(define-problem iev (data stream)
    "1 0 0 1 0 1"
    "3.5000"
  (let* ((dd (read data))
         (dh (read data))
         (dr (read data))
         (hh (read data))
         (hr (read data))
         (rr (read data)))
    (float-string
      ;; It's just a weighted averageā€¦
      (* 2 (+ (* dd 1)
              (* dh 1)
              (* dr 1)
              (* hh 3/4)
              (* hr 1/2)
              (* rr 0)))
      4)))