using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace lecture { class Program { static void Main(string[] args) { int X = int.Parse(Console.ReadLine()); int Y = int.Parse(Console.ReadLine()); int L = int.Parse(Console.ReadLine()); int result = 0; // X方向に進行 if (System.Math.Abs(X) % L == 0) { result = System.Math.Abs(X / L); } else { result += (System.Math.Abs(X / L)) + 1; } // Y方向に進行 if (System.Math.Abs(Y) % L == 0) { result += System.Math.Abs(Y / L); } else { result += (System.Math.Abs(Y / L)) + 1; } // Yが0より上でXが0でないなら方向転換は1回必要 if (Y >= 0 && X != 0) { result += 1; } // Yが0より下なら方向転換は2回必要 else if (Y < 0) { result += 2; } Console.WriteLine(result); } } }