Cod sursa(job #67167)

Utilizator al3csutzuSirbu Alexandru al3csutzu Data 22 iunie 2007 18:27:39
Problema Loto Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.57 kb
program loto;
var f,g:text;
n,i,s,max:integer;
a:array [1..100] of longint;
st:boolean;
begin
  assign(f,'loto.in'); assign(g,'loto.out');
  reset(f); rewrite(g);
  read (f,n,s);
  max:=0;
  for i:=1 to n do
    begin
      read(f,a[i]);
      if a[i]>max then max:=a[i];
    end;
  if s>6*max then writeln(g,'-1')
    else
     begin
        st:=false;
        for i:=1 to n do
        if s=6*a[i] then begin writeln(g,a[i],' ',a[i],' ',a[i],' ',a[i],' ',a[i],' ',a[i]); st:=true; end;
        if not st then writeln(g,'-1');
     end;
  close(f); close(g);
end.