using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace No48Robot { class Program { static void Main(string[] args) { //値の入力 decimal X = decimal.Parse(Console.ReadLine()); decimal Y = decimal.Parse(Console.ReadLine()); decimal L = decimal.Parse(Console.ReadLine()); decimal ans = 0; decimal x = Math.Abs(X / L); //絶対値にする x = Math.Ceiling(x); //切り上げる decimal y = Math.Abs(Y / L); y = Math.Ceiling(y); //計算 if (X == 0) { if (Y >= 0) //Yが正の時は移動回数が少ない { ans = x + y; } else { ans = x + y + 2; } } else if (X != 0) { if (Y >= 0) { ans = x + y + 1; } else { ans = x + y + 2; } } //表示 Console.WriteLine(ans); } } }