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(); int we = int.Parse(x); int ns = int.Parse(y); int forward = int.Parse(l); int posiwe = 0; int posins = 0; int command = 0; while (posiwe!=we||posins!=ns) { if (ns < 0 && posins != ns) { command = command + 2; if (ns - posins < forward) { posins = ns; command++; } else { posins = posins - forward; command++; } } else if (ns > 0 && posins != ns) { if (ns - posins < forward) { posins = ns; command++; } else { posins = posins + forward; command++; } } if (we < 0&&posiwe!=we) { command++; if (we - posiwe < forward) { posiwe = we; command++; } else { posiwe = posiwe - forward; command++; } } else if (we > 0&&posiwe != we) { command++; if (we - posiwe < forward) { posiwe = we; command++; } else { posiwe = posiwe + forward; command++; } } } Console.WriteLine(command); } } }