結果
問題 | No.149 碁石の移動 |
ユーザー | H20 |
提出日時 | 2022-09-02 10:35:11 |
言語 | Rust (1.77.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 2,827 bytes |
コンパイル時間 | 13,964 ms |
コンパイル使用メモリ | 395,024 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-15 15:49:27 |
合計ジャッジ時間 | 13,604 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,816 KB |
testcase_01 | AC | 1 ms
6,816 KB |
testcase_02 | AC | 1 ms
6,816 KB |
testcase_03 | AC | 1 ms
6,816 KB |
testcase_04 | AC | 1 ms
6,816 KB |
testcase_05 | AC | 1 ms
6,820 KB |
testcase_06 | AC | 1 ms
6,820 KB |
testcase_07 | AC | 1 ms
6,820 KB |
testcase_08 | AC | 1 ms
6,820 KB |
testcase_09 | AC | 0 ms
6,820 KB |
testcase_10 | AC | 1 ms
6,820 KB |
testcase_11 | AC | 0 ms
6,816 KB |
testcase_12 | AC | 1 ms
6,816 KB |
testcase_13 | AC | 1 ms
6,816 KB |
testcase_14 | AC | 1 ms
6,816 KB |
testcase_15 | AC | 1 ms
6,816 KB |
testcase_16 | AC | 1 ms
6,816 KB |
コンパイルメッセージ
warning: variable `bb` is assigned to, but never used --> src/main.rs:95:13 | 95 | mut bb : usize, | ^^ | = note: consider using `_bb` instead = note: `#[warn(unused_variables)]` on by default warning: value assigned to `ab` is never read --> src/main.rs:101:5 | 101 | ab -= a_catch_black; | ^^ | = help: maybe it is overwritten before being read? = note: `#[warn(unused_assignments)]` on by default warning: value assigned to `bb` is never read --> src/main.rs:103:5 | 103 | bb += a_catch_black; | ^^ | = help: maybe it is overwritten before being read?
ソースコード
use std::cmp; //USE https://mirrorless-camera.info/column/14417.html macro_rules! input { ($($r:tt)*) => { let mut bytes = std::io::Read::bytes(std::io::BufReader::new(std::io::stdin())); let mut next = move |is_word: bool| -> String{ if is_word { bytes .by_ref() .map(|r|r.unwrap() as char) .skip_while(|c|c.is_whitespace()) .take_while(|c|!c.is_whitespace()) .collect() } else { bytes .by_ref() .map(|r|r.unwrap() as char) .skip_while(|c| c == &'\n') .take_while(|c| c != &'\n') .collect() } }; input_inner!{next, $($r)*}; }; } macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, static $var:ident : $t:tt $($rest:tt)*) => { $var = read_value!($next, $t); input_inner!{$next $($rest)*} }; ($next:expr, mut $var:ident : $t:tt $($rest:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($rest)*} }; ($next:expr, $var:ident : $t:tt $($rest:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($rest)*} }; } macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; all ]) => { { let mut str = $next(false); str.split_whitespace().map(|it| it.parse::<$t>().unwrap()).collect::<Vec<_>>() } }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len as usize).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, lines) => { { let mut vec = Vec::new(); let mut str = $next(false); while str != "" { vec.push(str); str = $next(false); } vec } }; ($next:expr, line) => { $next(false) }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next(true).parse::<$t>().expect("Parse error") }; } fn main() { input! { mut aw : usize, mut ab : usize, mut bw : usize, mut bb : usize, c : usize, d : usize } let a_catch_black = cmp::min(ab,c); let a_catch_whilte = c-a_catch_black; ab -= a_catch_black; aw -= a_catch_whilte; bb += a_catch_black; bw += a_catch_whilte; let b_catch_whilte = cmp::min(bw,d); aw += b_catch_whilte; println!("{}",aw) }