Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,13 @@
|
|||
(*
|
||||
A solution I'd show to Euclid !!!!.
|
||||
Nigel Galloway May 4th., 2017
|
||||
*)
|
||||
let solve n =
|
||||
let (n,_)::(i,e)::g = n|>List.sortBy(fun n->(-(snd n)))
|
||||
let rec fn i g e l =
|
||||
match e with
|
||||
| (n,e)::t when n < i -> fn n g t (l+(i-n-1)*e)
|
||||
| (n,e)::t when n > g -> fn i n t (l+(n-g-1)*e)
|
||||
| (n,t)::e -> fn i g e (l-t)
|
||||
| _ -> l
|
||||
fn (min n i) (max n i) g (e*(abs(n-i)-1))
|
||||
Loading…
Add table
Add a link
Reference in a new issue