結果

問題 No.1446 ハンバーグと納豆ごはん
ユーザー tamatotamato
提出日時 2021-03-31 16:34:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 557 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 87,156 KB
実行使用メモリ 71,728 KB
最終ジャッジ日時 2023-08-21 15:05:58
合計ジャッジ時間 4,715 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,536 KB
testcase_01 AC 69 ms
71,704 KB
testcase_02 AC 70 ms
71,680 KB
testcase_03 AC 71 ms
71,504 KB
testcase_04 AC 71 ms
71,628 KB
testcase_05 AC 70 ms
71,456 KB
testcase_06 AC 69 ms
71,620 KB
testcase_07 AC 69 ms
71,724 KB
testcase_08 AC 71 ms
71,304 KB
testcase_09 AC 70 ms
71,484 KB
testcase_10 AC 70 ms
71,704 KB
testcase_11 AC 70 ms
71,512 KB
testcase_12 AC 69 ms
71,316 KB
testcase_13 AC 69 ms
71,660 KB
testcase_14 AC 71 ms
71,660 KB
testcase_15 AC 69 ms
71,400 KB
testcase_16 AC 67 ms
71,620 KB
testcase_17 AC 69 ms
71,504 KB
testcase_18 AC 70 ms
71,684 KB
testcase_19 AC 70 ms
71,664 KB
testcase_20 AC 69 ms
71,644 KB
testcase_21 AC 68 ms
71,656 KB
testcase_22 AC 69 ms
71,728 KB
testcase_23 AC 68 ms
71,396 KB
testcase_24 AC 68 ms
71,664 KB
testcase_25 AC 68 ms
71,644 KB
testcase_26 AC 70 ms
71,704 KB
testcase_27 AC 69 ms
71,440 KB
testcase_28 AC 69 ms
71,716 KB
testcase_29 AC 70 ms
71,688 KB
testcase_30 AC 70 ms
71,648 KB
testcase_31 AC 74 ms
71,400 KB
testcase_32 AC 70 ms
71,600 KB
testcase_33 AC 68 ms
71,656 KB
testcase_34 AC 70 ms
71,504 KB
testcase_35 AC 72 ms
71,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    a, b, n, m = map(int, input().split())
    ok = min(a, b)
    ng = max(a, b) + 1
    mid = (ok + ng) // 2
    while ng - ok > 1:
        if a > b:
            if b + (a - mid) // n >= mid:
                ok = mid
            else:
                ng = mid
        else:
            if a + (b - mid) // m >= mid:
                ok = mid
            else:
                ng = mid
        mid = (ok+ng) // 2
    print(ok)


if __name__ == '__main__':
    main()
0