program simulation; {HEC eco 1999} uses crt; var T : array[1..20001] of integer; U,S,i,n : integer; coincide : boolean; procedure X; begin randomize ; {initialisation de la fonction random} for i:=1 to 20001 do T[i]:=1+random(20000) end; begin X; i:=1;coincide:=false; repeat i:=i+1; S:=0; while (S<i-1) AND NOT coincide do begin S:=S+1; if T[S]=T[i] then coincide:=TRUE end; until coincide=true; U:=i; for n:=1 to i do write(T[n],' ; '); writeln; writeln('U = ',U); writeln('S = ',S); readln; end.