結果

問題 No.2227 King Kraken's Attack
ユーザー rlangevin
提出日時 2023-02-24 22:17:00
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 541 bytes
コンパイル時間 337 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 75,264 KB
最終ジャッジ日時 2024-10-02 11:15:45
合計ジャッジ時間 7,564 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 41 WA * 1
権限があれば一括ダウンロードができます

ソースコード

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(H + 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