using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace 競プロ { class Program { static void Main(string[] args) { // No.47 ポケットを叩くとビスケットが2倍 //string s = Console.ReadLine(); //var strs = s.Split(' '); var X = int.Parse(Console.ReadLine()); //移動先X var Y = int.Parse(Console.ReadLine()); //移動先Y var L = int.Parse(Console.ReadLine()); //1命令での最大移動距離 int count = 0; //命令回数 if (Y >= 0) { if (X == 0) ; else count++;//方向転換 } else { count += 2; } if (X < 0) X *= -1; if (Y < 0) Y *= -1; if (X != 0) count += ((X - 1) / L) + 1;//切り上げ if (Y != 0) count += ((Y - 1) / L) + 1;//切り上げ Console.WriteLine(count); Console.ReadLine(); } } }