結果

問題 No.2110 012 Matching
コンテスト
ユーザー urara
提出日時 2023-01-19 03:15:23
言語 Ruby
(4.0.2)
コンパイル:
ruby -w -c _filename_
実行:
ruby _filename_
結果
AC  
実行時間 236 ms / 2,000 ms
+ 225µs
コード長 318 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 9 ms
コンパイル使用メモリ 8,960 KB
実行使用メモリ 15,616 KB
最終ジャッジ日時 2026-07-25 22:12:44
合計ジャッジ時間 3,768 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #
raw source code

t = gets.to_i

results = []

t.times{
	a,b,c = gets.split.map &:to_i
	
	result = 0
	
	if c > a then
		result += a * 2
		c -= a
		result += c / 2
		result += b / 2 * 2
	else
		result += c * 2
		a = a - c
		result += b / 2 * 2
		
		if b % 2 == 1 && a>0 then
			result += 1
		end
	end
	
	results << result
}

puts results
0