結果

問題 No.2390 Udon Coupon (Hard)
ユーザー 👑 MizarMizar
提出日時 2023-07-04 03:35:47
言語 Ruby
(3.3.0)
結果
AC  
実行時間 431 ms / 2,000 ms
コード長 486 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-04-15 20:52:08
合計ジャッジ時間 9,793 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
12,160 KB
testcase_01 AC 91 ms
12,160 KB
testcase_02 AC 92 ms
12,032 KB
testcase_03 AC 92 ms
12,160 KB
testcase_04 AC 92 ms
12,288 KB
testcase_05 AC 157 ms
12,288 KB
testcase_06 AC 91 ms
12,160 KB
testcase_07 AC 90 ms
12,032 KB
testcase_08 AC 90 ms
11,904 KB
testcase_09 AC 256 ms
12,288 KB
testcase_10 AC 91 ms
12,032 KB
testcase_11 AC 89 ms
12,288 KB
testcase_12 AC 89 ms
12,288 KB
testcase_13 AC 92 ms
11,904 KB
testcase_14 AC 92 ms
12,160 KB
testcase_15 AC 90 ms
12,160 KB
testcase_16 AC 91 ms
12,032 KB
testcase_17 AC 90 ms
12,160 KB
testcase_18 AC 92 ms
12,160 KB
testcase_19 AC 93 ms
12,160 KB
testcase_20 AC 91 ms
12,160 KB
testcase_21 AC 91 ms
12,288 KB
testcase_22 AC 90 ms
12,288 KB
testcase_23 AC 91 ms
12,160 KB
testcase_24 AC 156 ms
12,288 KB
testcase_25 AC 158 ms
11,904 KB
testcase_26 AC 162 ms
12,160 KB
testcase_27 AC 157 ms
12,160 KB
testcase_28 AC 155 ms
12,288 KB
testcase_29 AC 272 ms
12,288 KB
testcase_30 AC 263 ms
12,160 KB
testcase_31 AC 266 ms
12,160 KB
testcase_32 AC 276 ms
12,032 KB
testcase_33 AC 273 ms
12,288 KB
testcase_34 AC 431 ms
12,160 KB
testcase_35 AC 409 ms
12,160 KB
testcase_36 AC 404 ms
12,160 KB
testcase_37 AC 415 ms
12,160 KB
testcase_38 AC 420 ms
12,032 KB
testcase_39 AC 269 ms
12,160 KB
testcase_40 AC 193 ms
12,288 KB
testcase_41 AC 255 ms
12,160 KB
testcase_42 AC 194 ms
12,160 KB
testcase_43 AC 180 ms
12,032 KB
testcase_44 AC 88 ms
12,160 KB
testcase_45 AC 104 ms
12,160 KB
testcase_46 AC 88 ms
12,160 KB
testcase_47 AC 88 ms
12,160 KB
testcase_48 AC 98 ms
12,288 KB
testcase_49 AC 90 ms
12,288 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
a1, b1 = gets.split.map(&:to_i)
a2, b2 = gets.split.map(&:to_i)
a3, b3 = gets.split.map(&:to_i)

exit(false) unless n > 0 && a1 > 0 && a2 > 0 && a3 > 0 && b1 > 0 && b2 > 0 && b3 > 0

a1, b1, a2, b2 = a2, b2, a1, b1 if a2 * b1 < a1 * b2
a1, b1, a3, b3 = a3, b3, a1, b1 if a3 * b1 < a1 * b3

r, i, s = 0, 0, n
while i < a1 && s >= 0 do
	j, t = 0, s
	while j < a1 && t >= 0 do
		r = [r, t / a1 * b1 + i * b2 + j * b3].max
		j += 1
		t -= a3
	end
	i += 1
	s -= a2
end

puts r
0