Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program fungus;
- const
- maxn = 110;
- iMod = 1000000007;
- moves : array[1..4, 1..2] of Integer = ((1,0),(0,1),(-1,0),(0,-1));
- var
- iArr : array[0..maxn] of array[0..maxn] of array[0..1] of int64;
- k, n, m, i, j, cur : integer;
- curX, curY : integer;
- iAns, iTotal : int64;
- begin
- // Do not focus on the entire solution, just take note of how the various structures are implemented
- Read(k);
- Read(n);
- Read(m);
- iArr[1][1][1] := 1;
- iArr[1][1][0] := 1;
- while (k > 0) do
- begin
- iAns := 0;
- for I := 1 to n do
- for j := 1 to m do
- begin
- iTotal := 0;
- for cur := 1 to 4 do
- begin
- curX := i + moves[cur][1];
- curY := j + moves[cur][2];
- if (curX < 1) or (curX > n) then continue;
- if (curY < 1) or (curY > m) then continue;
- if (moves[cur][1] = 1) or (moves[cur][2] = 1) then
- begin
- iTotal := iTotal + (iArr[curX][curY][1] mod iMod);
- end
- else
- begin
- iTotal := iTotal + (iArr[curX][curY][0] mod iMod);
- end;
- end;
- iArr[i][j][0] := iArr[i][j][1];
- iArr[i][j][1] := iArr[i][j][1] + (iTotal mod iMod);
- iAns := iAns + iArr[i][j][1];
- end;
- Dec(k);
- end;
- Writeln(iAns mod iMod);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement