Cells counting problem [closed]
There is a 3D grid with cells for which we define its value (0 or 1) as F(i,j,k)=F(开发者_StackOverflow社区i-1,j,k) XOR F(i,j-1,k) XOR F(i,j,k-1)
, base cases are F(0,0,0)=1
and F(x,y,z)=0
for x < 0 or y < 0 or z < 0
(if at least one parameter is negative).
We want to count amount of cells with F()=1
in the cube with corners (0,0,0)
and (N, M, K)
. Dimensions are about 2^30
.
I'm looking for the fast approach on this problem.
精彩评论