#include #include char str[60000]; int str_len = 0; /// /// 入力された数字を返す /// /// int ReadNum() { char c = getchar(); int num = 0; int numCnt = 0; while (c != '\n') { num = num * 10 + c - '0'; c = getchar(); } return num; } int main() { int x = ReadNum(); int y = ReadNum(); int l = ReadNum(); int order; if ((x > 0 && y > 0) || (x < 0 && y > 0)) { order = 1; } if ((x > 0 && y < 0) || (x < 0 && y < 0)) { order = 2; } if ((x == 0 && y == 0) || (x == 0 && y > 0)) { order = 0; } if ((y == 0 && x < 0) || (y == 0 && x > 0)) { order = 1; } if (x == 0 && y < 0) { order = 2; } if (x != 0) { order += x / l; if (x % l != 0) { order++; } } if (y != 0) { order += y / l; if (y % l != 0) { order++; } } printf("%d\n",order); }