結果

問題 No.2110 012 Matching
ユーザー tnakao0123tnakao0123
提出日時 2022-10-29 21:00:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 664 bytes
コンパイル時間 404 ms
コンパイル使用メモリ 40,936 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-20 23:08:03
合計ジャッジ時間 2,394 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 18 ms
4,376 KB
testcase_02 AC 44 ms
4,376 KB
testcase_03 AC 30 ms
4,384 KB
testcase_04 AC 58 ms
4,380 KB
testcase_05 AC 42 ms
4,376 KB
testcase_06 AC 40 ms
4,380 KB
testcase_07 AC 67 ms
4,380 KB
testcase_08 AC 3 ms
4,384 KB
testcase_09 AC 11 ms
4,380 KB
testcase_10 AC 66 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 2110.cc:  No.2110 012 Matching - yukicoder
 */

#include<cstdio>
#include<algorithm>
 
using namespace std;

/* constant */

/* typedef */

typedef long long ll;

/* global variables */

ll check(ll a, ll b, ll c, ll d02) {
  a -= d02, c -= d02;
  ll sum = d02 * 2 + c / 2 + (a > 0 ? b : b / 2 * 2);
  return sum;
}

/* subroutines */

/* main */

int main() {
  int tn;
  scanf("%d", &tn);

  while (tn--) {
    ll a, b, c;
    scanf("%lld%lld%lld", &a, &b, &c);

    ll d02 = min(a, c);
    ll sum = check(a, b, c, d02);
    if (d02 > 0)
      sum = max(sum, check(a, b, c, d02 - 1));

    printf("%lld\n", sum);
  }
  return 0;
}
0