#include int main() { // 宣言 int controlCnt = 0; signed int X = 0; signed int Y = 0; signed int distance = 0; // 入力値受け取り scanf("%d", &X); scanf("%d", &Y); scanf("%d", &distance); // X方向 if (Y >= 0) { controlCnt += Y / distance + (Y % distance > 0); if (X == 0) goto answer; } else { controlCnt ++; controlCnt += -Y / distance + (-Y % distance > 0); if (X == 0) goto answer; } // Y方向 controlCnt++; if (X > 0) controlCnt += X / distance + (X % distance > 0); else controlCnt += -X / distance + (-X % distance > 0); goto answer; // 回答表示 answer: printf("%d", controlCnt); return 0; }