結果
| 問題 | No.2420 Simple Problem | 
| コンテスト | |
| ユーザー |  だれ | 
| 提出日時 | 2023-08-12 14:29:19 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 756 ms / 2,000 ms | 
| コード長 | 443 bytes | 
| コンパイル時間 | 328 ms | 
| コンパイル使用メモリ | 82,252 KB | 
| 実行使用メモリ | 82,204 KB | 
| 最終ジャッジ日時 | 2024-11-19 19:44:57 | 
| 合計ジャッジ時間 | 24,262 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 33 | 
ソースコード
import sys
input=sys.stdin.readline
n = int(input())
for i in range(n):
    a, b = map(int, input().split())
    assert a > 0 and b > 0
    c = a + b
    d = (a - b) ** 2
    hi = 63246
    lw = 0
    while hi - lw > 1:
        mid = (hi + lw) // 2
        if mid ** 2 - c <= 0:
            lw = mid
            continue
        if mid ** 4 - (2 * (mid ** 2) * c) + d > 0:
            hi = mid
        else:
            lw = mid
    print(hi)
            
            
            
        