結果

問題 No.2420 Simple Problem
ユーザー Kyoro IDKyoro ID
提出日時 2023-08-13 09:08:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 777 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 82,388 KB
実行使用メモリ 95,696 KB
最終ジャッジ日時 2024-05-01 02:45:15
合計ジャッジ時間 18,901 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
73,284 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 451 ms
91,352 KB
testcase_28 AC 466 ms
91,604 KB
testcase_29 AC 460 ms
91,700 KB
testcase_30 AC 471 ms
91,348 KB
testcase_31 AC 462 ms
91,612 KB
testcase_32 AC 62 ms
72,384 KB
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import logging
import math
input = sys.stdin.readline
logger = logging.getLogger(__name__)


def read():
    N = int(input().strip())
    AB = []
    for i in range(N):
        a, b = map(int, input().strip().split())
        AB.append((a, b))
    return N, AB


def judge(x, a, b):
    left = a * b * 4
    right = (x * x - a - b) * (x * x - a - b)
    return left < right


def solve(N, AB):
    for a, b in AB:
        ok = 10**11
        ng = 2
        while abs(ok - ng) > 1:
            x = (ok + ng) // 2
            if judge(x, a, b):
                ok = x
            else:
                ng = x
        print(ok)


if __name__ == "__main__":
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))
0