結果

問題 No.1446 ハンバーグと納豆ごはん
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-03-31 14:07:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 460 bytes
コンパイル時間 446 ms
コンパイル使用メモリ 86,824 KB
実行使用メモリ 71,480 KB
最終ジャッジ日時 2023-08-21 08:44:48
合計ジャッジ時間 4,484 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,432 KB
testcase_01 AC 75 ms
71,156 KB
testcase_02 AC 76 ms
70,988 KB
testcase_03 AC 72 ms
70,988 KB
testcase_04 AC 73 ms
71,068 KB
testcase_05 AC 75 ms
71,092 KB
testcase_06 AC 73 ms
71,372 KB
testcase_07 AC 73 ms
70,932 KB
testcase_08 AC 76 ms
70,996 KB
testcase_09 AC 75 ms
70,988 KB
testcase_10 AC 74 ms
70,988 KB
testcase_11 AC 75 ms
70,988 KB
testcase_12 AC 77 ms
71,124 KB
testcase_13 AC 75 ms
71,260 KB
testcase_14 AC 76 ms
71,064 KB
testcase_15 AC 77 ms
70,988 KB
testcase_16 AC 73 ms
70,808 KB
testcase_17 AC 74 ms
70,936 KB
testcase_18 AC 74 ms
71,352 KB
testcase_19 AC 75 ms
71,092 KB
testcase_20 AC 75 ms
70,988 KB
testcase_21 AC 74 ms
70,824 KB
testcase_22 AC 74 ms
71,000 KB
testcase_23 AC 74 ms
71,344 KB
testcase_24 AC 74 ms
70,984 KB
testcase_25 AC 73 ms
71,232 KB
testcase_26 AC 76 ms
70,992 KB
testcase_27 AC 75 ms
71,156 KB
testcase_28 AC 75 ms
70,948 KB
testcase_29 AC 75 ms
70,920 KB
testcase_30 AC 75 ms
71,088 KB
testcase_31 AC 73 ms
71,480 KB
testcase_32 AC 72 ms
71,120 KB
testcase_33 AC 73 ms
71,264 KB
testcase_34 AC 75 ms
71,092 KB
testcase_35 AC 73 ms
70,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

"""

import sys
from sys import stdin

A,B,N,M = map(int,input().split())

l = 0
r = 10**19

while r-l != 1:

    m = (l+r)//2

    nA = A-m
    nB = B-m

    if nA < 0 and nB < 0:
        r = m
    elif nA < 0:
        nA += nB // M

        if nA >= 0:
            l = m
        else:
            r = m
    
    elif nB < 0:
        nB += nA // N
        if nB >= 0:
            l = m
        else:
            r = m
    else:
        l = m

print (l)
0