Source: https://lipn.univ-paris13.fr/~toulouse/doc/SupGalilee_INFO/c_banque_exo/exo_vrac/td8_corr.pdf