#include using namespace std; int main() { int x,y,l,cx,cy,r; int xx,yy; cin >> x >> y >> l; cx = 0; cy = 0; r = 0; //回転r if (x == 0) { if (y >= 0) { r = 0; }else{ r = 2; } }else if (y >= 0) { r = 1; }else if (y < 0){ r = 2; } //移動距離cx + cy if (x < 0) { xx = -x; }else{ xx = x; } if (y < 0) { yy = -y; }else{ yy = y; } if (xx % l == 0) { cx = xx / l; }else{ cx = xx / l + 1; } if (yy % l == 0) { cy = yy / l; }else{ cy = yy / l + 1; } cout << cx + cy + r << "\n"; return 0; }