Cod sursa(job #35348)

Utilizator andrei_infoMirestean Andrei andrei_info Data 21 martie 2007 23:44:13
Problema Diamant Scor 80
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.74 kb
//oni 2006 diamant cls 11-12 ziua 1
const min = -44100;
      max = 44100;

var n,m,x: longint;
    a,b:array[min..max] of longint;

procedure calc;
var i,j,k:longint;
begin
a[0]:=1;
for i:=1 to n do
        for j:=1 to m do
                begin
                for k:=min to max do
                        begin
                        b[k]:=(a[k+i*j] + a[k] + a[k-i*j]) mod 10000;
                        end;
                a:=b;
                end;
end;

begin
assign(input,'diamant.in'); reset(input);
assign(output,'diamant.out'); rewrite(output);
readln(n,m,x);
if abs(x) > 44100 then
        writeln('0')
else
        begin
        calc;
        writeln(a[x]);
        end;
close(input); close(output);
end.