結果

問題 No.2420 Simple Problem
ユーザー nautnaut
提出日時 2023-09-02 13:46:39
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 442 bytes
コンパイル時間 500 ms
コンパイル使用メモリ 87,488 KB
実行使用メモリ 78,752 KB
最終ジャッジ日時 2023-09-02 13:47:30
合計ジャッジ時間 48,103 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,276 KB
testcase_01 WA -
testcase_02 AC 93 ms
77,324 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 895 ms
77,976 KB
testcase_06 WA -
testcase_07 AC 1,621 ms
78,304 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 1,673 ms
78,304 KB
testcase_14 WA -
testcase_15 AC 1,657 ms
78,372 KB
testcase_16 WA -
testcase_17 AC 1,687 ms
78,296 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 1,642 ms
78,464 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 1,316 ms
78,160 KB
testcase_28 AC 1,314 ms
78,000 KB
testcase_29 AC 1,333 ms
78,152 KB
testcase_30 AC 1,344 ms
78,084 KB
testcase_31 AC 1,345 ms
78,108 KB
testcase_32 AC 69 ms
71,112 KB
testcase_33 AC 721 ms
77,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N = int(input())

    for _ in range(N):
        A, B = map(int, input().split())

        ng = 0
        ok = 1 << 20

        while ok - ng > 1:
            m = (ok + ng) // 2

            if m * m < A + B:
                ng = m
            else:
                if A * B < ((m * m - (A + B)) // 2) ** 2:
                    ok = m
                else:
                    ng = m

        print(ok)

    return 0


main()
0