結果

問題 No.2110 012 Matching
ユーザー simansiman
提出日時 2022-10-29 14:13:47
言語 Ruby
(3.3.0)
結果
AC  
実行時間 380 ms / 2,000 ms
コード長 300 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 11,388 KB
実行使用メモリ 16,108 KB
最終ジャッジ日時 2023-09-20 18:14:38
合計ジャッジ時間 4,503 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,180 KB
testcase_01 AC 157 ms
15,920 KB
testcase_02 AC 273 ms
16,092 KB
testcase_03 AC 210 ms
16,064 KB
testcase_04 AC 338 ms
16,016 KB
testcase_05 AC 262 ms
15,856 KB
testcase_06 AC 253 ms
15,940 KB
testcase_07 AC 372 ms
15,860 KB
testcase_08 AC 89 ms
16,108 KB
testcase_09 AC 123 ms
15,856 KB
testcase_10 AC 380 ms
15,876 KB
testcase_11 AC 78 ms
15,088 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

T = gets.to_i
T.times do
  a, b, c = gets.split.map(&:to_i)

  ans = 0

  d = [a, c].min
  ans += 2 * d
  a -= d
  c -= d
  e = b / 2
  ans += 2 * e
  b -= 2 * e

  if a > 0
    f = [a, b].min
    ans += f
    a -= f
    b -= f
  end

  if c > 0
    ans += c / 2
    c -= c / 2
  end

  puts ans
end
0