From 1b9ae718f61c77f56a799eea0c322b73b0774c30 Mon Sep 17 00:00:00 2001 From: Lucas Date: Mon, 15 Sep 2025 18:05:39 +0200 Subject: [PATCH] update ocaml file --- algo/ocaml/exo.ml | 23 +++++++++++++++++++++++ algo/ocaml/tp.ml | 21 ++++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/algo/ocaml/exo.ml b/algo/ocaml/exo.ml index 71d817f..26b9c12 100644 --- a/algo/ocaml/exo.ml +++ b/algo/ocaml/exo.ml @@ -32,3 +32,26 @@ let max3 a b c = if a>b && a>c then a else if b>c then b else c;; let min3 a b c = if a 0. + | x when x <= 500 -> 4.6 + | x when x <= 1000 -> 5.9 + | x when x <= 2000 -> 6.5 + | x when x <= 3000 -> 7.2 + | _ -> failwith "";; +let e a = match a with + x when x <= 0 -> 0. + | x when x <= 500 -> 3.4 + | x when x <= 1000 -> 4.6 + | x when x <= 2000 -> 5.1 + | x when x <= 3000 -> 6.9 + | _ -> failwith "";; +let ex a = match a with + x when x <= 0 -> 0. + | x when x <= 500 -> 9.1 + | x when x <= 1000 -> 11. + | x when x <= 2000 -> 13.5 + | x when x <= 3000 -> 14.2 + | _ -> failwith "";; + diff --git a/algo/ocaml/tp.ml b/algo/ocaml/tp.ml index e995e65..d2a3509 100644 --- a/algo/ocaml/tp.ml +++ b/algo/ocaml/tp.ml @@ -24,4 +24,23 @@ let ctc x = else invalid_arg"somme pas egale a 9" else invalid_arg"3 non pairs";; -ctc 2025;; + +let day d m y = + if m=1||m=3||m=5||m=7||m=8||m=10||m=12 then + if d>1 && d<31 then + d,m,y + else failwith "" + else if m=2 then + if d>1 && d<28 then + d,m,y + else failwith "" + else if m=4||m=6||m=9||m=10 then + if d>1 && d<30 then + d,m,y + else + failwith "" + else failwith "";; + + + +day 12 9 2024;;