結果
問題 |
No.2420 Simple Problem
|
ユーザー |
|
提出日時 | 2023-08-13 09:08:37 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 777 bytes |
コンパイル時間 | 209 ms |
コンパイル使用メモリ | 82,856 KB |
実行使用メモリ | 96,048 KB |
最終ジャッジ日時 | 2024-11-21 02:40:07 |
合計ジャッジ時間 | 19,461 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 6 WA * 27 |
ソースコード
import sys import logging import math input = sys.stdin.readline logger = logging.getLogger(__name__) def read(): N = int(input().strip()) AB = [] for i in range(N): a, b = map(int, input().strip().split()) AB.append((a, b)) return N, AB def judge(x, a, b): left = a * b * 4 right = (x * x - a - b) * (x * x - a - b) return left < right def solve(N, AB): for a, b in AB: ok = 10**11 ng = 2 while abs(ok - ng) > 1: x = (ok + ng) // 2 if judge(x, a, b): ok = x else: ng = x print(ok) if __name__ == "__main__": inputs = read() outputs = solve(*inputs) if outputs is not None: print("%s" % str(outputs))