macro_rules! scan { ($buf:expr) => {{ use std::io::{stdin, BufRead}; use std::str::FromStr; $buf.clear(); stdin().lock().read_line(&mut $buf).unwrap(); FromStr::from_str($buf.trim()).unwrap() }}; } fn main() { let mut b = String::new(); let x: i32 = scan!(b); let y: i32 = scan!(b); let l: i32 = scan!(b); let mut c; if (x != 0 && y != 0) || (x == 0 && y < 0) { c = 2; } else if x != 0 && y == 0 { c = 1; } else { c = 0; } let mut pos_x = x; while 0 < pos_x { pos_x -= l; c += 1; } let mut pos_y = y; while 0 < pos_y { pos_y -= l; c += 1; } println!("{c}"); }