Cod sursa(job #7556)

Utilizator mipsPavel Mircea mips Data 21 ianuarie 2007 17:29:09
Problema 1-sir Scor 80
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.45 kb
const max=32000;
var v1,v2:array[-max..max] of longint;
n,s,i,j:longint;
begin
assign(input,'1-sir.in');
reset(input);
readln(n,s);
v1[0]:=1;
fillchar(v2,sizeof(v2),0);
for i:=1 to n-1 do
begin
for j:=-max to max do
if v1[j]<>0 then
begin
v2[j+i]:=(v2[j+i]+v1[j]) mod 194767;
v2[j-i]:=(v2[j-i]+v1[j]) mod 194767;
end;
v1:=v2;
fillchar(v2,sizeof(v2),0);
end;
assign(output,'1-sir.out');
rewrite(output);
writeln(v1[s]);
close(output);
end.