Pagini recente » Cod sursa (job #1004628) | Cod sursa (job #1061131) | Cod sursa (job #453857) | Cod sursa (job #2337155) | Cod sursa (job #21741)
Cod sursa(job #21741)
program iepuri;
type mat=array[1..100,1..50]of integer;
var m:mat;
a,b,c,x,y,z,i:integer;
n:longint;
f:text;
procedure citire(var n:longint;var m:mat);
var i,j:integer;
f:text;
begin
assign(f,'iepuri.in');reset(f);
readln(f,n);
for i:=1 to n do
for j:=1 to 7 do read(f,m[i,j]);
close(f);
end;
function nr_iepuri(l:integer):longint;
var i,j:integer;
begin
{if x=0 then nr_iepuri:=0 else}
if l=1 then nr_iepuri:=y else
if l=2 then nr_iepuri:=z else
if l=3 then nr_iepuri:=a*z+b*y+c*x
else nr_iepuri:=a*nr_iepuri(l-1)+b*nr_iepuri(l-2)+c*nr_iepuri(l-3);
end;
begin
citire(n,m);
assign(f,'iepuri.out');rewrite(f);
for i:=1 to n do begin
x:=m[i,1];
y:=m[i,2];
z:=m[i,3];
a:=m[i,4];
b:=m[i,5];
c:=m[i,6];
n:=m[i,7];
writeln(f,(nr_iepuri(n) mod 666013));
end;
close(f);
end.