Cod sursa(job #1132576)
Utilizator | Data | 3 martie 2014 17:32:55 | |
---|---|---|---|
Problema | Loto | Scor | 10 |
Compilator | fpc | Status | done |
Runda | Arhiva de probleme | Marime | 1.53 kb |
var a:array[1..101] of longint;
s,n,i,j,k,l,m,q:longint;
u:byte;
begin
assign(input,'loto.in');
assign(output,'loto.out');
reset(input);
rewrite(output);
u:=1;
readln(n,s);
for i:=1 to n do
read(a[i]);
for i:=1 to n do
begin
if u=0 then break;
for j:=1 to n do
begin
if u=0 then break;
for k:=1 to n do
begin
if u=0 then break;
for l:=1 to n do
begin
if u=0 then break;
for m:=1 to n do
begin
if u=0 then break;
for q:=1 to n do
if a[i]+a[j]+a[k]+a[l]+a[m]+a[q]=s then begin
if u=0 then break
else begin
u:=0;
writeln(a[i],' ',a[j],' ',a[k],' ',a[l],' ',a[m],' ',a[q]);
break;
end;
end;
end;
end;
end;
end;
end;
if u=1 then writeln('-1');
close(input);
close(output);
{Totusi este trist in lume}
end.