結果

問題 No.2390 Udon Coupon (Hard)
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-07-21 23:52:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 264 ms / 2,000 ms
コード長 507 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 82,496 KB
実行使用メモリ 63,872 KB
最終ジャッジ日時 2024-04-15 21:05:11
合計ジャッジ時間 6,624 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
51,968 KB
testcase_01 AC 50 ms
60,160 KB
testcase_02 AC 50 ms
60,416 KB
testcase_03 AC 48 ms
60,416 KB
testcase_04 AC 50 ms
60,160 KB
testcase_05 AC 62 ms
60,160 KB
testcase_06 AC 39 ms
51,968 KB
testcase_07 AC 39 ms
52,352 KB
testcase_08 AC 40 ms
51,712 KB
testcase_09 AC 264 ms
63,360 KB
testcase_10 AC 50 ms
60,288 KB
testcase_11 AC 45 ms
58,368 KB
testcase_12 AC 49 ms
60,288 KB
testcase_13 AC 50 ms
60,416 KB
testcase_14 AC 49 ms
60,288 KB
testcase_15 AC 47 ms
60,416 KB
testcase_16 AC 50 ms
60,544 KB
testcase_17 AC 48 ms
60,288 KB
testcase_18 AC 50 ms
61,056 KB
testcase_19 AC 51 ms
61,056 KB
testcase_20 AC 40 ms
52,480 KB
testcase_21 AC 39 ms
52,480 KB
testcase_22 AC 49 ms
60,288 KB
testcase_23 AC 50 ms
60,160 KB
testcase_24 AC 96 ms
61,568 KB
testcase_25 AC 105 ms
61,696 KB
testcase_26 AC 97 ms
61,568 KB
testcase_27 AC 101 ms
61,824 KB
testcase_28 AC 97 ms
61,696 KB
testcase_29 AC 161 ms
62,976 KB
testcase_30 AC 148 ms
62,976 KB
testcase_31 AC 165 ms
63,360 KB
testcase_32 AC 162 ms
62,976 KB
testcase_33 AC 158 ms
62,848 KB
testcase_34 AC 254 ms
63,360 KB
testcase_35 AC 245 ms
62,976 KB
testcase_36 AC 233 ms
63,112 KB
testcase_37 AC 253 ms
63,104 KB
testcase_38 AC 248 ms
63,104 KB
testcase_39 AC 157 ms
63,232 KB
testcase_40 AC 110 ms
61,824 KB
testcase_41 AC 150 ms
63,872 KB
testcase_42 AC 107 ms
62,336 KB
testcase_43 AC 153 ms
63,872 KB
testcase_44 AC 149 ms
63,360 KB
testcase_45 AC 122 ms
63,232 KB
testcase_46 AC 98 ms
61,824 KB
testcase_47 AC 95 ms
62,592 KB
testcase_48 AC 175 ms
63,360 KB
testcase_49 AC 40 ms
52,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
AB = [list(map(int,input().split())) for i in range(3)]

ans = 0

ma = max([a for a,b in AB])

for i in range(3):

    AB = AB[1:] + [AB[0]]
    a1,b1 = AB[0]
    a2,b2 = AB[1]
    a3,b3 = AB[2]
    for x in range(ma+1):
        if x*a1 > n:
            break

        for y in range(ma+1):
            if x*a1 + y*a2 > n:
                break

            count = b1*x + b2*y 
            left = n - x*a1 - y*a2
            count += left//a3*b3
            ans = max(ans,count)
print(ans)
0