結果

問題 No.2227 King Kraken's Attack
ユーザー rlangevin
提出日時 2023-10-11 13:35:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 459 ms / 2,000 ms
コード長 549 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 82,564 KB
実行使用メモリ 75,264 KB
最終ジャッジ日時 2024-09-13 12:19:21
合計ジャッジ時間 8,745 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 42
権限があれば一括ダウンロードができます

ソースコード

diff #

def check(h, w):
    yoko = min(H, h * LA)
    tate = min(W, w * LB)
    nokori = H * W - yoko * tate
    return h * KA + w * KB - nokori >= 0 

H, W, LA, LB, KA, KB = map(int, input().split())
ans = 10 ** 18
for h in range(max(H, W) + 1):
    yes = 10 ** 6
    if not check(h, yes):
        continue
    if check(h, 0):
        ans = min(ans, h)
        continue
    no = 0
    while yes - no != 1:
        mid = (yes + no)//2
        if check(h, mid):
            yes = mid
        else:
            no = mid
    ans = min(ans, h + yes)
print(ans)
0