結果

問題 No.2110 012 Matching
ユーザー tnakao0123
提出日時 2022-10-29 21:00:37
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 664 bytes
コンパイル時間 396 ms
コンパイル使用メモリ 41,288 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-06 17:55:05
合計ジャッジ時間 3,864 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

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