Cod sursa(job #41459)

Utilizator adella_stanciuStanciu Adela adella_stanciu Data 28 martie 2007 11:57:56
Problema Loto Scor 5
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.47 kb
var f,g:text;v:array[1..100] of longint;n,i:byte;max,s:longint;
begin
     assign(f,'loto.in');reset(f);assign(g,'loto.out');rewrite(g);
     readln(f,n,s);max:=0;
     for i:=1 to n do begin
         read(f,v[i]);
         if v[i]>max then max:=v[i];
     end;
     if (s div max>=6) and (s mod max<>0) then writeln(g,-1)
                    else if (s div max=6) and (s mod max=0) then
                            for i:=1 to 6 do write(g,max,' ');
     close(g);
end.