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