結果
問題 | No.2420 Simple Problem |
ユーザー |
![]() |
提出日時 | 2023-08-12 14:07:41 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 898 ms / 2,000 ms |
コード長 | 457 bytes |
コンパイル時間 | 327 ms |
コンパイル使用メモリ | 82,292 KB |
実行使用メモリ | 77,092 KB |
最終ジャッジ日時 | 2024-11-19 17:31:09 |
合計ジャッジ時間 | 27,264 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 33 |
ソースコード
n = int(input()) def is_ok(mid, a, b): c = mid*mid-a-b if(c < 0): return False if(4*a*b < c*c): return True else: return False def binary_search(ng, ok, a, b): while ok - ng > 1: mid = (ok + ng) // 2 if is_ok(mid, a, b): ok = mid else: ng = mid return ok for _ in range(n): a,b = map(int, input().split()) x = binary_search(0, 10**9, a, b) print(x)