using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace yukicoder_48 { 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 xa = Math.Abs(x); int ya = Math.Abs(y); int count = 0; //x方向のカウント if (xa % l == 0) { count += xa / l; } else { for(int i = 1; xa - i * l > 0; i++) { count++; } count++; } //y方向のカウント if (ya % l == 0) { count += ya / l; } else { for (int i = 1; ya - i * l > 0; i++) { count++; } count++; } //回転回数 if (y<0){ count += 2; }else if (x != 0) { count++; } Console.WriteLine(count); Console.ReadLine(); } } }