Pagini recente » baga_tare_lucaciu | Cod sursa (job #1034734) | Cod sursa (job #529664) | Cod sursa (job #1829076) | Cod sursa (job #137466)
Cod sursa(job #137466)
program NOD_SoFTWARE;
var p,nr,q,i,j,n,m,k:longint;
fost,suma,rez:longint;
fin,fout:text;
gasit:boolean;
{*------------------*}
procedure fact(i:integer);
begin
fost:=1;
for q:=1 to i do
begin
{ suma:=1;}
suma:=fost*q;
fost:=suma;
end;
end;
{*------------------*}
begin
assign(fin,'factoriale.in'); reset(fin);
assign(fout,'factoriale.out'); rewrite(fout);
readln(fin,n,k);
rez:=1;
for i:=1 to n do
begin
read(fin,nr);
fact(nr);
rez:=rez*suma;
end;
gasit:=false;
i:=0;
p:=0;
while not gasit do
begin
inc(i);
suma:=rez*i;
j:=1;
while p <=suma do
begin
inc(j);
p:=j;
for Q:=2 to k do p:=p*j;
if p = suma then
begin
{ writeln(fout,suma);
writeln(fout,j); }
writeln(fout,i);
close(fout);
exit;
end;
end;
end;
writeln(fout,rez);
close(fin);
close(fout);
end.