結果
問題 |
No.643 Two Operations No.2
|
ユーザー |
![]() |
提出日時 | 2023-01-02 20:21:35 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 343 bytes |
コンパイル時間 | 12,025 ms |
コンパイル使用メモリ | 378,100 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-27 01:14:52 |
合計ジャッジ時間 | 12,973 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 |
コンパイルメッセージ
warning: variable does not need to be mutable --> src/main.rs:4:6 | 4 | let mut xy: Vec<i32> = xy.trim().split_whitespace() | ----^^ | | | help: remove this `mut` | = note: `#[warn(unused_mut)]` on by default
ソースコード
fn main() { let mut xy = String::new(); std::io::stdin().read_line(&mut xy).ok(); let mut xy: Vec<i32> = xy.trim().split_whitespace() .map(|e| e.parse().unwrap()).collect(); let ans = if xy[0] == xy[1] { 0 } else if xy[0] == 0 { 2 } else if xy[1] == 0 { 1 } else if xy[0] == -xy[1] { 3 } else { -1 }; println!("{}", ans); }