結果
問題 |
No.48 ロボットの操縦
|
ユーザー |
|
提出日時 | 2019-04-26 17:59:02 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 648 bytes |
コンパイル時間 | 21,683 ms |
コンパイル使用メモリ | 388,984 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-24 17:56:42 |
合計ジャッジ時間 | 13,705 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 WA * 6 |
ソースコード
fn read<T: std::str::FromStr>() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn main() { let x: i32 = read(); let y: i32 = read(); let l: i32 = read(); let add_step = |a: i32| { if a != 0 { if a.abs() % l > 0 { a.abs() / l + 1 } else { a.abs() / l } } else { 0 } }; let mut step = 0; if y < 0 { step += 2; } step += add_step(y); if x != 0 { step += 1; } step += add_step(x); println!("{}", step); }