結果

問題 No.2420 Simple Problem
ユーザー aradarad
提出日時 2023-08-12 13:56:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 789 ms / 2,000 ms
コード長 304 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 76,416 KB
最終ジャッジ日時 2024-04-30 04:32:08
合計ジャッジ時間 25,229 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,712 KB
testcase_01 AC 369 ms
76,032 KB
testcase_02 AC 76 ms
68,480 KB
testcase_03 AC 187 ms
76,032 KB
testcase_04 AC 626 ms
76,416 KB
testcase_05 AC 426 ms
76,416 KB
testcase_06 AC 766 ms
76,416 KB
testcase_07 AC 771 ms
76,160 KB
testcase_08 AC 761 ms
76,160 KB
testcase_09 AC 786 ms
76,160 KB
testcase_10 AC 760 ms
76,032 KB
testcase_11 AC 789 ms
76,416 KB
testcase_12 AC 773 ms
76,288 KB
testcase_13 AC 763 ms
76,160 KB
testcase_14 AC 768 ms
76,032 KB
testcase_15 AC 765 ms
76,288 KB
testcase_16 AC 777 ms
76,288 KB
testcase_17 AC 779 ms
76,160 KB
testcase_18 AC 763 ms
76,288 KB
testcase_19 AC 779 ms
76,032 KB
testcase_20 AC 764 ms
76,160 KB
testcase_21 AC 771 ms
76,416 KB
testcase_22 AC 765 ms
76,032 KB
testcase_23 AC 769 ms
76,160 KB
testcase_24 AC 769 ms
76,032 KB
testcase_25 AC 769 ms
76,032 KB
testcase_26 AC 43 ms
52,736 KB
testcase_27 AC 626 ms
76,032 KB
testcase_28 AC 616 ms
76,032 KB
testcase_29 AC 620 ms
75,904 KB
testcase_30 AC 619 ms
75,904 KB
testcase_31 AC 611 ms
76,032 KB
testcase_32 AC 41 ms
52,096 KB
testcase_33 AC 363 ms
76,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
for _ in range(n):
    a,b = map(int,input().split())
    ok = 100100
    ng = 0
    def f(x):
        return x*x-a-b >= 0 and 4*a*b < (x*x-a-b)**2
    while abs(ok-ng) > 1:
        mid = (ok+ng)//2
        if f(mid):
            ok = mid
        else:
            ng = mid
    print(ok)
0