There is a hypercube with sides of length 2 and a hypersphere with a radius of 1. Both of them are centered at the origin (the hypercube surrounds the hypersphere). Each of the d dimensions in the hypercube is divided into K segments, so that the hypercube is dissected into K^d “small” hypercubes. Which means, each of the small hypercubes h has volume (2/K)^d.
How do you classify each small hypercube h, into one of three categories: either it is wholly inside the hypersphere, wholly outside the hypersphere, or else the surface of the hypersphere passes through h.
Note: You cannot calculate the volume of the hypersphere to find out how many small hypercubes fit in the hypersphere of radius 1.
My approach has been to see which small hypercubes are entirely within a distance of 1 from the origin, but I don't know which coordinates of the small hypercube to use to compare against the unit distance from the origin.
Your setup is a bit strange, as the dissection into $K$ segments (in each direction) would yield a central segment (centered at the origin) when $K$ is odd and 2 segments on either side of the origin when $K$ is even.
Thus I'll restrict to $K$ being even only in my following answer. (An analogue could be given for $K$ being odd, for sure.)
For a small cube of side length $2/K$ being completely contained within the hypersphere the outermost vertex has to have a Pythagorean coordinates squared sum lower than 1. According to my previous restriction this gives
$$\sum_{i=1}^d (n_i\frac2K)^2 < 1$$
For a small cube of side length $2/K$ being completely outside the hypersphere the innermost vertex has to have a Pythagorean coordinates squared sum larger than 1. According to my previous restriction this gives
$$\sum_{i=1}^d ((n_i-1)\frac2K)^2 > 1$$
Thus you'd just have to check all $d$-tuples with each position number $-K/2 \leq n_i \leq K/2$ whether it would belong to the first case (inside), the second case (outside), or else (somehow hitting the hypersphere).
--- rk