Pagini recente » Cod sursa (job #1213796) | Cod sursa (job #1170336)
program p1;
type tablou=array[1..100,1..8]of real;
var v:array[1..100] of longint;
t:tablou;
i,j,p,z:longint;
f,g:text;
procedure calcul;
begin
for j:=1 to z do
begin
for i:=3 to v[j] do
begin
t[j,7]:=t[j,4]*t[j,3]+t[j,5]*t[j,2]+t[j,6]*t[j,1];
t[j,1]:=t[j,2];
t[j,2]:=t[j,3];
t[j,3]:=t[j,7];
end;
writeln(g,t[j,7]:5:0);
end;
end;
procedure citire;
begin;
assign(f,'iepuri.in');
reset(f);
read(f,Z);
for i:=1 to z do
begin
begin
for j:=1 to 6 do
read(f,t[i,j]);
end;
read(f,v[i]);
end;
close(f);
end;
begin
citire;
assign(g,'iepuri.out');
rewrite(g);
calcul;
close(g);
end.