Cod sursa(job #670385)

Utilizator lostfanAndrei lostfan Data 28 ianuarie 2012 23:10:31
Problema Iepuri Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.51 kb
type tab=array [1..7] of integer;
var ta:array [0..100] of integer;
t:array [1..100] of tab;
var i,j,n,k:integer;
fi,fo:text;
begin
assign(fi,'iepuri.in'); reset(fi);
assign(fo,'iepuri.out'); rewrite(fo);
readln(fi,k);
for i:=1 to k do begin
for j:=1 to 7 do
read(fi,t[i][j]);
readln(fi);
end;
for j:=1 to k do begin
ta[0]:=t[j][1];
ta[1]:=t[j][2];
ta[2]:=t[j][3];
n:=t[j][7];
for i:=3 to n do
ta[i]:=t[j][4]*ta[i-1]+t[j][5]*ta[i-2]+t[j][6]*ta[i-3];
writeln(fo,ta[n]);
end;
close(fi); close(fo);
end.