using System; using System.Collections.Generic; using System.Linq; public class Program { public static void Main(System.String[] args) { var x = int.Parse(Console.ReadLine()); var y = int.Parse(Console.ReadLine()); var maxMove = int.Parse(Console.ReadLine()); var orderCnt = 0; var rotCnt = 0; if (y == 0) rotCnt = 1; if (y > 0 && x != 0) rotCnt = 1; if (y < 0 && x != 0) rotCnt = 3; var move_x = Math.Abs(x / maxMove); var move_y = Math.Abs(y / maxMove); var div_x = x % maxMove; var div_y = y % maxMove; if ( maxMove < div_x ) move_x += div_x / maxMove; else move_x += div_x; if ( maxMove < div_y ) move_y += div_y / maxMove; else move_y += div_y; orderCnt = (move_x + move_y + rotCnt); Console.WriteLine(orderCnt); } }