結果
問題 | No.2420 Simple Problem |
ユーザー |
👑 |
提出日時 | 2023-08-12 14:01:05 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
AC
|
実行時間 | 238 ms / 2,000 ms |
コード長 | 480 bytes |
コンパイル時間 | 242 ms |
コンパイル使用メモリ | 5,120 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-19 17:02:13 |
合計ジャッジ時間 | 10,438 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 33 |
ソースコード
local mfl, mce = math.floor, math.ceil local q = io.read("*n") local function solve(x, a, b) local v = 1LL * x * x - a - b if v < 0LL then return false end if 2000000000LL < v then return true end return 4LL * a * b < v * v end for iq = 1, q do local a, b = io.read("*n", "*n") local l, r = 0, 1000000001 while 1 < r - l do local mid = mfl((l + r) / 2) if solve(mid, a, b) then r = mid else l = mid end end print(r) end