結果

問題 No.2390 Udon Coupon (Hard)
ユーザー 👑 amentorimaruamentorimaru
提出日時 2023-07-03 21:35:22
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,052 ms / 2,000 ms
コード長 437 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-04-15 20:49:03
合計ジャッジ時間 16,622 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
12,288 KB
testcase_01 AC 85 ms
12,288 KB
testcase_02 AC 83 ms
12,416 KB
testcase_03 AC 82 ms
12,160 KB
testcase_04 AC 82 ms
12,288 KB
testcase_05 AC 648 ms
12,160 KB
testcase_06 AC 82 ms
12,288 KB
testcase_07 AC 82 ms
12,288 KB
testcase_08 AC 82 ms
12,288 KB
testcase_09 AC 549 ms
12,288 KB
testcase_10 AC 86 ms
12,288 KB
testcase_11 AC 83 ms
12,160 KB
testcase_12 AC 81 ms
12,288 KB
testcase_13 AC 81 ms
12,288 KB
testcase_14 AC 82 ms
12,160 KB
testcase_15 AC 83 ms
12,288 KB
testcase_16 AC 83 ms
12,160 KB
testcase_17 AC 85 ms
12,288 KB
testcase_18 AC 85 ms
12,160 KB
testcase_19 AC 84 ms
12,288 KB
testcase_20 AC 84 ms
12,160 KB
testcase_21 AC 86 ms
12,288 KB
testcase_22 AC 86 ms
12,160 KB
testcase_23 AC 84 ms
12,160 KB
testcase_24 AC 266 ms
12,160 KB
testcase_25 AC 276 ms
12,288 KB
testcase_26 AC 290 ms
12,288 KB
testcase_27 AC 276 ms
12,160 KB
testcase_28 AC 261 ms
12,288 KB
testcase_29 AC 602 ms
12,288 KB
testcase_30 AC 570 ms
12,416 KB
testcase_31 AC 587 ms
12,288 KB
testcase_32 AC 606 ms
12,288 KB
testcase_33 AC 594 ms
12,160 KB
testcase_34 AC 1,052 ms
12,288 KB
testcase_35 AC 992 ms
12,288 KB
testcase_36 AC 982 ms
12,160 KB
testcase_37 AC 1,022 ms
12,416 KB
testcase_38 AC 1,012 ms
12,032 KB
testcase_39 AC 596 ms
12,160 KB
testcase_40 AC 378 ms
12,288 KB
testcase_41 AC 561 ms
12,160 KB
testcase_42 AC 373 ms
12,416 KB
testcase_43 AC 343 ms
12,288 KB
testcase_44 AC 85 ms
12,288 KB
testcase_45 AC 135 ms
12,416 KB
testcase_46 AC 87 ms
12,160 KB
testcase_47 AC 86 ms
12,288 KB
testcase_48 AC 116 ms
12,288 KB
testcase_49 AC 84 ms
12,288 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
A = Array.new(3)
B = Array.new(3)
(0..2).each do |i|
    A[i], B[i] = gets.split.map(&:to_i)
end
if A[1]*B[2] < A[2]*B[1] then
    A[2],B[2],A[1],B[1]=A[1],B[1],A[2],B[2]
end
if A[0]*B[2] < A[2]*B[0] then
    A[0],B[0],A[2],B[2]=A[2],B[2],A[0],B[0]	
end

ans=0
(0..A[2]).each do |i|
    (0..A[2]).each do |j|	
        ans = [ans, (N-A[0]*i-A[1]*j)/A[2]*B[2] + i*B[0]+j*B[1]].max if A[0]*i+A[1]*j <= N
    end
end
puts (ans)
0