結果
| 問題 |
No.2110 012 Matching
|
| コンテスト | |
| ユーザー |
👑 terry_u16
|
| 提出日時 | 2022-10-28 21:52:43 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 154 ms / 2,000 ms |
| コード長 | 1,796 bytes |
| コンパイル時間 | 12,870 ms |
| コンパイル使用メモリ | 378,048 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-06 00:59:27 |
| 合計ジャッジ時間 | 15,553 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 11 |
コンパイルメッセージ
warning: value assigned to `c` is never read --> src/main.rs:61:9 | 61 | c -= c_count * 2; | ^ | = help: maybe it is overwritten before being read? = note: `#[warn(unused_assignments)]` on by default warning: value assigned to `a` is never read --> src/main.rs:65:9 | 65 | a -= ab_count; | ^ | = help: maybe it is overwritten before being read? warning: value assigned to `b` is never read --> src/main.rs:66:9 | 66 | b -= ab_count; | ^ | = help: maybe it is overwritten before being read?
ソースコード
macro_rules! get {
($t:ty) => {
{
let mut line: String = String::new();
std::io::stdin().read_line(&mut line).unwrap();
line.trim().parse::<$t>().unwrap()
}
};
($($t:ty),*) => {
{
let mut line: String = String::new();
std::io::stdin().read_line(&mut line).unwrap();
let mut iter = line.split_whitespace();
(
$(iter.next().unwrap().parse::<$t>().unwrap(),)*
)
}
};
($t:ty; $n:expr) => {
(0..$n).map(|_|
get!($t)
).collect::<Vec<_>>()
};
($($t:ty),*; $n:expr) => {
(0..$n).map(|_|
get!($($t),*)
).collect::<Vec<_>>()
};
($t:ty ;;) => {
{
let mut line: String = String::new();
std::io::stdin().read_line(&mut line).unwrap();
line.split_whitespace()
.map(|t| t.parse::<$t>().unwrap())
.collect::<Vec<_>>()
}
};
($t:ty ;; $n:expr) => {
(0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
};
}
fn main() {
let test_cases = get!(usize);
for _ in 0..test_cases {
let (mut a, mut b, mut c) = get!(i64, i64, i64);
let mut result = 0;
let b_count = b / 2;
result += b_count * 2;
b -= b_count * 2;
let ac_count = a.min(c);
a -= ac_count;
c -= ac_count;
result += ac_count * 2;
let c_count = c / 2;
result += c_count;
c -= c_count * 2;
let ab_count = a.min(b);
result += ab_count;
a -= ab_count;
b -= ab_count;
println!("{}", result);
}
}
terry_u16