結果

問題 No.2420 Simple Problem
ユーザー gr1msl3ygr1msl3y
提出日時 2023-08-16 00:52:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 428 ms / 2,000 ms
コード長 339 bytes
コンパイル時間 581 ms
コンパイル使用メモリ 82,288 KB
実行使用メモリ 102,984 KB
最終ジャッジ日時 2024-05-03 10:51:57
合計ジャッジ時間 16,569 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
52,096 KB
testcase_01 AC 241 ms
84,816 KB
testcase_02 AC 61 ms
69,504 KB
testcase_03 AC 131 ms
78,632 KB
testcase_04 AC 317 ms
96,360 KB
testcase_05 AC 244 ms
88,040 KB
testcase_06 AC 428 ms
102,392 KB
testcase_07 AC 379 ms
102,000 KB
testcase_08 AC 373 ms
101,864 KB
testcase_09 AC 382 ms
101,872 KB
testcase_10 AC 375 ms
101,740 KB
testcase_11 AC 399 ms
102,224 KB
testcase_12 AC 391 ms
102,256 KB
testcase_13 AC 389 ms
102,412 KB
testcase_14 AC 389 ms
102,120 KB
testcase_15 AC 380 ms
101,744 KB
testcase_16 AC 395 ms
102,132 KB
testcase_17 AC 380 ms
101,996 KB
testcase_18 AC 389 ms
102,116 KB
testcase_19 AC 391 ms
102,136 KB
testcase_20 AC 387 ms
102,392 KB
testcase_21 AC 377 ms
101,996 KB
testcase_22 AC 397 ms
102,984 KB
testcase_23 AC 389 ms
102,252 KB
testcase_24 AC 378 ms
102,248 KB
testcase_25 AC 382 ms
101,996 KB
testcase_26 AC 37 ms
52,736 KB
testcase_27 AC 309 ms
96,588 KB
testcase_28 AC 320 ms
96,832 KB
testcase_29 AC 323 ms
96,616 KB
testcase_30 AC 317 ms
96,640 KB
testcase_31 AC 307 ms
96,572 KB
testcase_32 AC 36 ms
51,968 KB
testcase_33 AC 201 ms
84,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(a, b):
    l, r = 0, 10**5
    while r-l > 1:
        m = (l+r)//2
        v = (m**2-a-b)**2-4*a*b
        if v > 0 and m**2 > a+b:
            r = m
        else:
            l = m
    return r


N = int(input())
ans = []
for _ in range(N):
    a, b = map(int, input().split())
    ans.append(solve(a, b))
print(*ans, sep='\n')
0