using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace yukicoderTest { class Program { static void Main(string[] args) { string x = Console.ReadLine(); string y = Console.ReadLine(); string l = Console.ReadLine(); long we = int.Parse(x); long ns = int.Parse(y); long forward = int.Parse(l); long posiwe = 0; long posins = 0; long command = 0; if(ns<0) { command = command + 2; } while (posins != ns) { if (ns < 0 ) { if (ns*-1 - posins*-1 < forward) { posins = ns; command++; } else { posins = posins - forward; command++; } } else if (ns > 0) { if (ns - posins < forward) { posins = ns; command++; } else { posins = posins + forward; command++; } } } if (posiwe != we) { command++; } while (posiwe != we) { if (we < 0) { if (we * -1 - posiwe*-1 < forward) { posiwe = we; command++; } else { posiwe = posiwe - forward; command++; } } else if (we > 0) { if (we - posiwe < forward) { posiwe = we; command++; } else { posiwe = posiwe + forward; command++; } } } Console.WriteLine(command); } } }