#include int go_forward(int dest_pos, int allowed_distance) { int dest_pos_abs = std::abs(dest_pos); if (dest_pos_abs <= allowed_distance) { return 1; } int mod = dest_pos_abs % allowed_distance; int quo = dest_pos_abs / allowed_distance; return (mod == 0) ? quo : quo + 1; } int main(int argc, char *argv[]) { int dest_x = 0; int dest_y = 0; int allowed_distance = 0; int order_count = 0; std::cin >> dest_x; std::cin >> dest_y; std::cin >> allowed_distance; // y axis if (dest_y != 0) { if (dest_y < 0) { order_count += 2; } order_count += go_forward(dest_y, allowed_distance); } // x axis if (dest_x != 0) { order_count += 1; order_count += go_forward(dest_x, allowed_distance); } std::cout << order_count << std::endl; return 0; }