Fully cover a rectangle with minimum amount of fixed radius circles

后端 未结 5 1496
自闭症患者
自闭症患者 2021-01-31 04:07

I\'ve had this problem for a few years. It was on an informatics contest in my town a while back. I failed to solve it, and my teacher failed to solve it. I haven\'t met anyone

5条回答
  •  被撕碎了的回忆
    2021-01-31 04:27

    According my calculations the right answer is:

    D=2*R; X >= 2*D, Y >= 2*D,
    N = ceil(X/D) + ceil(Y/D) + 2*ceil(X/D)*ceil(Y/D)
    

    In particular case if the remainder for X/D and Y/D equal to 0, then

    N = (X + Y + X*Y/R)/D
    
    Case 1: R = 1, X = 2, Y = 2, then  N = 4
    
    Case 2: R = 1, X = 4, Y = 6, then  N = 17
    
    Case 3: R = 1, X = 5, Y = 7, then  N = 31
    

    Hope it helps.

提交回复
热议问题