結果

問題 No.2110 012 Matching
ユーザー 👑 terry_u16terry_u16
提出日時 2022-10-28 21:52:43
言語 Rust
(1.77.0)
結果
AC  
実行時間 172 ms / 2,000 ms
コード長 1,796 bytes
コンパイル時間 4,298 ms
コンパイル使用メモリ 135,036 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-09-20 04:47:28
合計ジャッジ時間 7,056 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,356 KB
testcase_01 AC 44 ms
4,356 KB
testcase_02 AC 114 ms
4,352 KB
testcase_03 AC 77 ms
4,356 KB
testcase_04 AC 152 ms
4,356 KB
testcase_05 AC 107 ms
4,356 KB
testcase_06 AC 103 ms
4,352 KB
testcase_07 AC 172 ms
4,352 KB
testcase_08 AC 6 ms
4,352 KB
testcase_09 AC 26 ms
4,352 KB
testcase_10 AC 171 ms
4,356 KB
testcase_11 AC 1 ms
4,352 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: value assigned to `c` is never read
  --> 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
  --> Main.rs:65:9
   |
65 |         a -= ab_count;
   |         ^
   |
   = help: maybe it is overwritten before being read?

warning: value assigned to `b` is never read
  --> Main.rs:66:9
   |
66 |         b -= ab_count;
   |         ^
   |
   = help: maybe it is overwritten before being read?

warning: 3 warnings emitted

ソースコード

diff #

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);
    }
}
0