結果
| 問題 |
No.48 ロボットの操縦
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-10-14 22:05:31 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 761 bytes |
| コンパイル時間 | 14,032 ms |
| コンパイル使用メモリ | 399,124 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-24 15:12:33 |
| 合計ジャッジ時間 | 15,808 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 WA * 6 |
ソースコード
use std::io::{self, Read};
fn read_stdin() -> Vec<String> {
let mut buffer = String::new();
io::stdin().read_to_string(&mut buffer).ok();
buffer.trim().split('\n').map(|s| s.to_string()).collect()
}
fn main() {
let input = read_stdin();
let mut cnt: usize = 0;
let x = *&input[0].parse::<isize>().unwrap();
let y = *&input[1].parse::<isize>().unwrap();
if y < 0 {
cnt += 2;
}
let mut pos = vec![x.abs(), y.abs()];
let l: isize = *&input[2].parse::<isize>().unwrap();
while *&pos[1] > 0 {
pos[1] = *&pos[1] - l;
cnt += 1;
}
if *&pos[0] != 0 {
cnt += 1;
}
while *&pos[0] > 0 {
pos[0] = *&pos[0] - l;
cnt += 1;
}
println!("{}", cnt);
}