結果
問題 | No.149 碁石の移動 |
ユーザー | iwot |
提出日時 | 2020-06-07 20:03:33 |
言語 | Rust (1.77.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 796 bytes |
コンパイル時間 | 1,675 ms |
コンパイル使用メモリ | 143,208 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-08-25 13:11:53 |
合計ジャッジ時間 | 2,765 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 1 ms
4,380 KB |
testcase_05 | AC | 1 ms
4,380 KB |
testcase_06 | AC | 1 ms
4,376 KB |
testcase_07 | AC | 1 ms
4,376 KB |
testcase_08 | AC | 1 ms
4,376 KB |
testcase_09 | AC | 1 ms
4,376 KB |
testcase_10 | AC | 1 ms
4,376 KB |
testcase_11 | AC | 1 ms
4,376 KB |
testcase_12 | AC | 1 ms
4,376 KB |
testcase_13 | AC | 1 ms
4,380 KB |
testcase_14 | AC | 1 ms
4,376 KB |
testcase_15 | AC | 1 ms
4,384 KB |
testcase_16 | AC | 1 ms
4,376 KB |
コンパイルメッセージ
warning: unused variable: `ab` --> Main.rs:26:8 | 26 | let (ab, bb, c) = if ab >= c { | ^^ help: if this is intentional, prefix it with an underscore: `_ab` | = note: `#[warn(unused_variables)]` on by default warning: unused variable: `bb` --> Main.rs:26:12 | 26 | let (ab, bb, c) = if ab >= c { | ^^ help: if this is intentional, prefix it with an underscore: `_bb` warning: unused variable: `bw` --> Main.rs:33:12 | 33 | let (aw, bw) = if bw >= d { | ^^ help: if this is intentional, prefix it with an underscore: `_bw` warning: 3 warnings emitted
ソースコード
macro_rules! read { ($x:ident, $v:expr, $idx:expr, $type:ty) => { let $x:$type = $v[$idx].clone().parse().unwrap(); }; ( $($x:ident:$t:ty),* ) => { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); let input:Vec<String> = s.trim() .split_whitespace() .map(|e| e.parse().ok().unwrap()) .collect(); let mut idx:i64 = -1; $( idx += 1; read!($x, input, idx as usize, $t); )* }; } fn main() { read!(aw:i64, ab:i64); read!(bw:i64, bb:i64); read!(c:i64, d:i64); let (ab, bb, c) = if ab >= c { (ab - c, bb + c, 0) } else { (0, bb + ab, c - ab) }; let (aw, bw) = (aw - c, bw + c); let (aw, bw) = if bw >= d { (aw + d, bw - d) } else { (aw + bw, 0) }; println!("{}", aw); }