update ocaml file

This commit is contained in:
2025-09-15 18:05:39 +02:00
parent 92632d3039
commit 1b9ae718f6
2 changed files with 43 additions and 1 deletions

View File

@@ -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<b && a<c then a else if b<c then b else c;; let min3 a b c = if a<b && a<c then a else if b<c then b else c;;
(*3.7*)
let s a = match a with
x when x <= 0 -> 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 "";;

View File

@@ -24,4 +24,23 @@ let ctc x =
else invalid_arg"somme pas egale a 9" else invalid_arg"somme pas egale a 9"
else invalid_arg"3 non pairs";; 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;;