Cod sursa(job #6948)

Utilizator mipsPavel Mircea mips Data 21 ianuarie 2007 11:05:56
Problema 1-sir Scor 50
Compilator fpc Status done
Runda preONI 2007, Runda 1, Clasele 11-12 Marime 0.45 kb
const max=64000;
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.