Clock shows 'h' hours, 'm' minutes and 's' seconds after midnight.
Your task is to make 'Past' function which returns time converted to milliseconds.
將 hours, minutes, seconds 轉成 milliseconds
(ns kata.test
(:require [clojure.test :refer :all]
[kata :refer [past]]))
(defn tester [h m s e]
(testing (str "(past " h " " m " " s ")")
(is (= (past h m s) e))))
(deftest basic-tests
(tester 0 1 1 61000)
(tester 1 1 1 3661000)
(tester 0 0 0 0)
(tester 1 0 1 3601000)
(tester 1 0 0 3600000))
(ns kata)
(defn past [h m s]
(* 1000 (+ (* h 3600) (* m 60) s)))
Given three integers a ,b ,c, return the largest number obtained after inserting the following operators and brackets: +, , ()
In other words , try every combination of a,b,c with [+()] , and return the Maximum Obtained
給予三個數字 a, b, c
,使用 *, +, ()
各種組合,找出結果最大的組合
(ns expression.matter-test
(:require [expression.matter :refer :all]
[clojure.test :refer :all]))
(deftest basic-tests
(testing "(expression-matter 2 1 2)" (is (= (expression-matter 2 1 2) 6)))
(testing "(expression-matter 2 1 1)" (is (= (expression-matter 2 1 1) 4)))
(testing "(expression-matter 1 1 1)" (is (= (expression-matter 1 1 1) 3)))
(testing "(expression-matter 1 2 3)" (is (= (expression-matter 1 2 3) 9)))
(testing "(expression-matter 1 3 1)" (is (= (expression-matter 1 3 1) 5)))
(testing "(expression-matter 2 2 2)" (is (= (expression-matter 2 2 2) 8)))
(testing "(expression-matter 5 1 3)" (is (= (expression-matter 5 1 3) 20)))
(testing "(expression-matter 3 5 7)" (is (= (expression-matter 3 5 7) 105)))
(testing "(expression-matter 5 6 1)" (is (= (expression-matter 5 6 1) 35)))
(testing "(expression-matter 1 6 1)" (is (= (expression-matter 1 6 1) 8)))
(testing "(expression-matter 2 6 1)" (is (= (expression-matter 2 6 1) 14)))
(testing "(expression-matter 6 7 1)" (is (= (expression-matter 6 7 1) 48)))
(testing "(expression-matter 2 10 3)" (is (= (expression-matter 2 10 3) 60)))
(testing "(expression-matter 1 8 3)" (is (= (expression-matter 1 8 3) 27)))
(testing "(expression-matter 9 7 2)" (is (= (expression-matter 9 7 2) 126)))
(testing "(expression-matter 1 1 10)" (is (= (expression-matter 1 1 10) 20)))
(testing "(expression-matter 9 1 1)" (is (= (expression-matter 9 1 1) 18)))
(testing "(expression-matter 10 5 6)" (is (= (expression-matter 10 5 6) 300)))
(testing "(expression-matter 1 10 1)" (is (= (expression-matter 1 10 1) 12))))
(ns expression.matter)
(defn expression-matter [a b c]
(max
(* (+ b c) a)
(* (* a b) c)
(+ (* b c) a)
(* (+ a b) c)
(+ (+ a b) c)
)
)