Блог пользователя oartihsin

Автор oartihsin, история, 4 года назад, По-английски

black has to travel n-x distance row-wise and n-y distance column wise to reach the coin at (x,y). Hence total distance travelled by black is b = n-x + n-y. Similary white has to travel x-1 distance row wise and y-1 column wise. Total distance travelled by white is w = x-1 + y-1. if(b<w) answer is black. else answer is white(if(w<b) it is obvious ... but if b==w then white reaches first as white starts the game and is always a move ahead of black) -

  • Проголосовать: нравится
  • -2
  • Проголосовать: не нравится