Pagini recente » Diferente pentru problema/troll intre reviziile 14 si 15 | Cod sursa (job #1793636) | Diferente pentru problema/marmote intre reviziile 2 si 10 | Cod sursa (job #2645120) | Cod sursa (job #1169437)
var t,i:byte;
a,b,c,x,y,z:word;
n,s,j:longword;
f,g:text;
function fun(s:longword):longword;
begin
if s=0 then fun:=x
else if s=1 then fun:=y
else if s=2 then fun:=z
else fun:=a*fun(s-1)+b*fun(s-2)+c*fun(s-3);
end;
begin
assign(f,'iepuri.in'); assign(g,'iepuri.out'); reset(f); rewrite(g);
readln(f,t);
for i:=1 to t do
begin
readln(f,x,y,z,a,b,c,n);
writeln(g,fun(n));
end;
close(f);
close(g);
end.