Source: https://cours-examens.org/images/An_2013_2/Etude_superieure/Ingeniorat_informatique/MATHETINFO/epita/epita-2010-thl-correction.pdf