Check if any square ( with one colored cell ) can be divided into two equal parts | function to check if it 's possible to divide the square in two equal parts ; if the painted square is linked anyway to the center of the square then it 's  not possible ; else yes it 's possible ; initialize the size of the square ; initialize the dimension of the painted square
< ? php function halfsquare ( $ n , $ x , $ y ) { $ half = $ n / 2 ; if ( ( $ half == $ x $ half == $ x - 1 ) && ( $ half == $ y $ half == $ y - 1 ) ) echo " NO " ; else echo " YES " ; } $ n = 100 ; $ x = 51 ; $ y = 100 ; halfsquare ( $ n , $ x , $ y ) ; ? >