September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -0,0 +1,16 @@
|
|||
(defn delta [entry]
|
||||
(case (second (re-find #"\ (.*)\ @" entry))
|
||||
"IN " -1
|
||||
"OUT" 1
|
||||
(throw (Exception. (str "Invalid entry:" entry)))))
|
||||
|
||||
(defn t [entry]
|
||||
(second (re-find #"@\ (.*)\ f" entry)))
|
||||
|
||||
(let [entries (clojure.string/split (slurp "mlijobs.txt") #"\n")
|
||||
in-use (reductions + (map delta entries))
|
||||
m (apply max in-use)
|
||||
times (map #(nth (map t entries) %)
|
||||
(keep-indexed #(when (= m %2) %1) in-use))]
|
||||
(println "Maximum simultaneous license use is" m "at the following times:")
|
||||
(map println times))
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
nOut,maxOut,maxTimes:=0,-1,List();
|
||||
foreach job in (File("mlijobs.txt")){
|
||||
_,status,_,date:=job.split();
|
||||
nOut+=( if(status.toUpper()=="OUT") 1 else -1 );
|
||||
if(nOut>maxOut){ maxOut=nOut; maxTimes.clear(); }
|
||||
if(nOut==maxOut) maxTimes.append(date);
|
||||
}
|
||||
println(("Maximum simultaneous license use is %d at"
|
||||
" the following times:\n %s").fmt(maxOut,maxTimes.concat("\n")));
|
||||
Loading…
Add table
Add a link
Reference in a new issue