Skip to content

Latest commit

 

History

History
10 lines (7 loc) · 571 Bytes

description.md

File metadata and controls

10 lines (7 loc) · 571 Bytes

Description:

Beetles do not like to be next to each other and everyone hides under a separate stone and tries to choose stones that are as far from the neighbors as possible. Also, bugs like to be located as far from the edge. Once the beetle has sat behind a stone, it no longer moves. In total, there are X stones in the line. And there sequentially run Y beetles to hide. Find how many free stones will be to the left and right of the last bug. X may be up to 4 billion.

Example:

X=8, Y=1 => 3,4
X=8, Y=2 => 1,2
X=8, Y=3 => 1,1
X=8, Y=4 => 0,1