結果

問題 No.2110 012 Matching
ユーザー chro_96
提出日時 2022-10-28 21:35:51
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 68 ms / 2,000 ms
コード長 603 bytes
コンパイル時間 712 ms
コンパイル使用メモリ 29,440 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-06 00:39:43
合計ジャッジ時間 1,895 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main () {
  int t = 0;
  
  int res = 0;
  
  res = scanf("%d", &t);
  
  while (t > 0) {
    long long a = 0LL;
    long long b = 0LL;
    long long c = 0LL;
    long long ans = 0LL;
    res = scanf("%lld", &a);
    res = scanf("%lld", &b);
    res = scanf("%lld", &c);
    ans = (b/2LL)*2LL;
    b %= 2LL;
    if (a < c) {
      ans += 2LL*a;
      c -= a;
      a = 0LL;
      ans += c/2LL;
    } else {
      ans += 2LL*c;
      a -= c;
      c = 0LL;
      if (a > 0LL && b > 0LL) {
        ans += 1LL;
      }
    }
    printf("%lld\n", ans);
    t--;
  }
  
  return 0;
}
0