\documentclass[a4paper,11pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[french]{babel}
\usepackage[a4paper,top=3.2cm,bottom=2cm,left=2cm,right=2cm]{geometry}
\usepackage{graphicx}
\usepackage[export]{adjustbox}
\usepackage{fancyhdr}
\usepackage{qrcode}
\usepackage[table]{xcolor}
\usepackage{amsmath,amssymb}
\usepackage{enumitem}
% Puces nettes (babel-french remplace sinon la puce par un tiret « – » peu pro).
% Vaut pour TOUTES les fiches qui importent ce module. AtBeginDocument pour
% passer après la personnalisation des listes faite par babel-french.
\AtBeginDocument{%
  \setlist[itemize]{leftmargin=1.8em,itemsep=0.5ex,topsep=0.4ex,parsep=0pt}%
  \setlist[itemize,1]{label=\textcolor{red!75!black}{\small\textbullet}}%
  \setlist[itemize,2]{label=\textcolor{red!75!black}{\scriptsize\textbullet}}%
}
% Titres compacts (gain de place vertical, fiches plus denses) — vaut pour tous.
\usepackage{titlesec}
\titlespacing*{\section}{0pt}{1.4ex}{0.6ex}
\titlespacing*{\subsection}{0pt}{1.0ex}{0.3ex}
% multicol : listes denses (calcul mental) sur 2 colonnes — neutre tant qu'il
% n'est pas utilisé, dispo pour tous les générateurs.
\usepackage{multicol}
\setlength{\columnsep}{1.5em}
% needspace : empêche un titre d'exercice de rester orphelin en bas de page
% (réserve quelques lignes ; sinon le titre passe à la page suivante avec sa
% liste). Neutre tant qu'il n'est pas appelé — dispo pour tous les générateurs.
\usepackage{needspace}
\usepackage{tikz}
\usetikzlibrary{decorations.text}

\usepackage{tgheros}
\pagestyle{fancy}
\fancyhf{}
% Pas de filet sous l'en-tête : fancyhdr en trace un de 0,4 pt par
% défaut, et il coupe la page juste sous le logo.
\renewcommand{\headrulewidth}{0pt}
\setlength{\headheight}{75pt}
\setlength{\headsep}{10pt}

\newcommand{\logowouf}{%
\begin{tikzpicture}[baseline={(current bounding box.center)},scale=0.55,
                    line cap=round,line join=round]
    \path[use as bounding box] (-2.20,-1.45) rectangle (2.20,2.20);
    \path[
        postaction={decorate},
        decoration={
            text along path,
            text={|\fontfamily{qhv}\bfseries\fontsize{9}{9}\selectfont|site2wouf.fr},
            text align={center},
            raise=0.03ex
        }
    ] (-1.29,0.48) arc[start angle=160,end angle=20,radius=1.29];
    \begin{scope}[xshift=-0.06cm]
        \fill[black] (-0.66,0.14) ellipse (0.21 and 0.31);
        \fill[black] ( 0.66,0.14) ellipse (0.21 and 0.31);
        \fill[black] (-0.23,0.49) ellipse (0.22 and 0.35);
        \fill[black] ( 0.23,0.49) ellipse (0.22 and 0.35);
        \fill[black]
            (0,-0.10)
            .. controls (-0.36,-0.02) and (-0.63,-0.24) .. (-0.58,-0.58)
            .. controls (-0.52,-0.93) and (-0.16,-1.12) .. (0,-0.90)
            .. controls (0.16,-1.12) and (0.52,-0.93) .. (0.58,-0.58)
            .. controls (0.63,-0.24) and (0.36,-0.02) .. (0,-0.10)
            -- cycle;
    \end{scope}
\end{tikzpicture}%
}

\newcommand{\titre}{Les 25 immeubles}
\newcommand{\soustitre}{Un casse-tête de gratte-ciel : retrouver la hauteur de chaque immeuble}

\fancyhead[C]{%
\raisebox{4pt}{%
\begin{minipage}[c]{0.15\textwidth}
    \centering
    \logowouf
\end{minipage}
\begin{minipage}[c]{0.62\textwidth}
    \centering
    {\Large\bfseries \titre\par}
    {\small\color{gray} \soustitre}
\end{minipage}
\begin{minipage}[c]{0.21\textwidth}
    \centering
    \qrcode[height=1.5cm]{https://site2wouf.fr/immeubles25.php?x=255}\\[2pt]
    {\small\ttfamily\bfseries\color{red} IMMV0255}
\end{minipage}%
}
}

\begin{document}

\begin{center}
    \small La zone contient des immeubles. Dans chaque ligne et chaque colonne apparaissent des immeubles de hauteurs toutes différentes (1, 2, 3, 4 ou 5 étages). Les observateurs placés autour regardent perpendiculairement à leur bord : le nombre inscrit indique combien d’immeubles ils voient (un immeuble plus haut cache ceux qui sont derrière). Retrouvez la hauteur de chaque immeuble de la zone.
\end{center}
\vspace{0.5em}

\begin{center}
\begin{tikzpicture}[x=2.000cm, y=2.000cm]
  \draw (0,0) rectangle (1,-1);
  \draw (1,0) rectangle (2,-1);
  \draw (2,0) rectangle (3,-1);
  \draw (3,0) rectangle (4,-1);
  \draw (4,0) rectangle (5,-1);
  \draw (0,-1) rectangle (1,-2);
  \draw (1,-1) rectangle (2,-2);
  \draw (2,-1) rectangle (3,-2);
  \draw (3,-1) rectangle (4,-2);
  \draw (4,-1) rectangle (5,-2);
  \draw (0,-2) rectangle (1,-3);
  \draw (1,-2) rectangle (2,-3);
  \draw (2,-2) rectangle (3,-3);
  \draw (3,-2) rectangle (4,-3);
  \draw (4,-2) rectangle (5,-3);
  \draw (0,-3) rectangle (1,-4);
  \draw (1,-3) rectangle (2,-4);
  \draw (2,-3) rectangle (3,-4);
  \draw (3,-3) rectangle (4,-4);
  \draw (4,-3) rectangle (5,-4);
  \draw (0,-4) rectangle (1,-5);
  \draw (1,-4) rectangle (2,-5);
  \draw (2,-4) rectangle (3,-5);
  \draw (3,-4) rectangle (4,-5);
  \draw (4,-4) rectangle (5,-5);
  \node[font=\LARGE\bfseries\color{red}] at (0.5,0.5) {3};
  \node[font=\LARGE\bfseries\color{red}] at (0.5,-5.5) {2};
  \node[font=\LARGE\bfseries\color{red}] at (1.5,0.5) {4};
  \node[font=\LARGE\bfseries\color{red}] at (1.5,-5.5) {2};
  \node[font=\LARGE\bfseries\color{red}] at (2.5,0.5) {5};
  \node[font=\LARGE\bfseries\color{red}] at (2.5,-5.5) {1};
  \node[font=\LARGE\bfseries\color{red}] at (3.5,0.5) {1};
  \node[font=\LARGE\bfseries\color{red}] at (3.5,-5.5) {2};
  \node[font=\LARGE\bfseries\color{red}] at (4.5,0.5) {2};
  \node[font=\LARGE\bfseries\color{red}] at (4.5,-5.5) {2};
  \node[font=\LARGE\bfseries\color{red}] at (-0.5,-0.5) {2};
  \node[font=\LARGE\bfseries\color{red}] at (5.5,-0.5) {2};
  \node[font=\LARGE\bfseries\color{red}] at (-0.5,-1.5) {2};
  \node[font=\LARGE\bfseries\color{red}] at (5.5,-1.5) {1};
  \node[font=\LARGE\bfseries\color{red}] at (-0.5,-2.5) {1};
  \node[font=\LARGE\bfseries\color{red}] at (5.5,-2.5) {5};
  \node[font=\LARGE\bfseries\color{red}] at (-0.5,-3.5) {2};
  \node[font=\LARGE\bfseries\color{red}] at (5.5,-3.5) {4};
  \node[font=\LARGE\bfseries\color{red}] at (-0.5,-4.5) {2};
  \node[font=\LARGE\bfseries\color{red}] at (5.5,-4.5) {3};
\end{tikzpicture}
\end{center}


\newpage

{\Large\bfseries\color{red} Correction}\par\medskip

\begin{center}
\begin{tikzpicture}[x=2.000cm, y=2.000cm]
  \draw (0,0) rectangle (1,-1);
  \node[font=\LARGE\bfseries] at (0.5,-0.5) {3};
  \draw (1,0) rectangle (2,-1);
  \node[font=\LARGE\bfseries] at (1.5,-0.5) {2};
  \draw (2,0) rectangle (3,-1);
  \node[font=\LARGE\bfseries] at (2.5,-0.5) {1};
  \draw (3,0) rectangle (4,-1);
  \node[font=\LARGE\bfseries] at (3.5,-0.5) {5};
  \draw (4,0) rectangle (5,-1);
  \node[font=\LARGE\bfseries] at (4.5,-0.5) {4};
  \draw (0,-1) rectangle (1,-2);
  \node[font=\LARGE\bfseries] at (0.5,-1.5) {4};
  \draw (1,-1) rectangle (2,-2);
  \node[font=\LARGE\bfseries] at (1.5,-1.5) {3};
  \draw (2,-1) rectangle (3,-2);
  \node[font=\LARGE\bfseries] at (2.5,-1.5) {2};
  \draw (3,-1) rectangle (4,-2);
  \node[font=\LARGE\bfseries] at (3.5,-1.5) {1};
  \draw (4,-1) rectangle (5,-2);
  \node[font=\LARGE\bfseries] at (4.5,-1.5) {5};
  \draw (0,-2) rectangle (1,-3);
  \node[font=\LARGE\bfseries] at (0.5,-2.5) {5};
  \draw (1,-2) rectangle (2,-3);
  \node[font=\LARGE\bfseries] at (1.5,-2.5) {4};
  \draw (2,-2) rectangle (3,-3);
  \node[font=\LARGE\bfseries] at (2.5,-2.5) {3};
  \draw (3,-2) rectangle (4,-3);
  \node[font=\LARGE\bfseries] at (3.5,-2.5) {2};
  \draw (4,-2) rectangle (5,-3);
  \node[font=\LARGE\bfseries] at (4.5,-2.5) {1};
  \draw (0,-3) rectangle (1,-4);
  \node[font=\LARGE\bfseries] at (0.5,-3.5) {1};
  \draw (1,-3) rectangle (2,-4);
  \node[font=\LARGE\bfseries] at (1.5,-3.5) {5};
  \draw (2,-3) rectangle (3,-4);
  \node[font=\LARGE\bfseries] at (2.5,-3.5) {4};
  \draw (3,-3) rectangle (4,-4);
  \node[font=\LARGE\bfseries] at (3.5,-3.5) {3};
  \draw (4,-3) rectangle (5,-4);
  \node[font=\LARGE\bfseries] at (4.5,-3.5) {2};
  \draw (0,-4) rectangle (1,-5);
  \node[font=\LARGE\bfseries] at (0.5,-4.5) {2};
  \draw (1,-4) rectangle (2,-5);
  \node[font=\LARGE\bfseries] at (1.5,-4.5) {1};
  \draw (2,-4) rectangle (3,-5);
  \node[font=\LARGE\bfseries] at (2.5,-4.5) {5};
  \draw (3,-4) rectangle (4,-5);
  \node[font=\LARGE\bfseries] at (3.5,-4.5) {4};
  \draw (4,-4) rectangle (5,-5);
  \node[font=\LARGE\bfseries] at (4.5,-4.5) {3};
  \node[font=\LARGE\bfseries\color{red}] at (0.5,0.5) {3};
  \node[font=\LARGE\bfseries\color{red}] at (0.5,-5.5) {2};
  \node[font=\LARGE\bfseries\color{red}] at (1.5,0.5) {4};
  \node[font=\LARGE\bfseries\color{red}] at (1.5,-5.5) {2};
  \node[font=\LARGE\bfseries\color{red}] at (2.5,0.5) {5};
  \node[font=\LARGE\bfseries\color{red}] at (2.5,-5.5) {1};
  \node[font=\LARGE\bfseries\color{red}] at (3.5,0.5) {1};
  \node[font=\LARGE\bfseries\color{red}] at (3.5,-5.5) {2};
  \node[font=\LARGE\bfseries\color{red}] at (4.5,0.5) {2};
  \node[font=\LARGE\bfseries\color{red}] at (4.5,-5.5) {2};
  \node[font=\LARGE\bfseries\color{red}] at (-0.5,-0.5) {2};
  \node[font=\LARGE\bfseries\color{red}] at (5.5,-0.5) {2};
  \node[font=\LARGE\bfseries\color{red}] at (-0.5,-1.5) {2};
  \node[font=\LARGE\bfseries\color{red}] at (5.5,-1.5) {1};
  \node[font=\LARGE\bfseries\color{red}] at (-0.5,-2.5) {1};
  \node[font=\LARGE\bfseries\color{red}] at (5.5,-2.5) {5};
  \node[font=\LARGE\bfseries\color{red}] at (-0.5,-3.5) {2};
  \node[font=\LARGE\bfseries\color{red}] at (5.5,-3.5) {4};
  \node[font=\LARGE\bfseries\color{red}] at (-0.5,-4.5) {2};
  \node[font=\LARGE\bfseries\color{red}] at (5.5,-4.5) {3};
\end{tikzpicture}
\end{center}

\end{document}
