問題一覧 > 通常問題

No.2420 Simple Problem

レベル : / AI推定難易度 : 1225 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 154
作問者 : Nafmo2 / テスター : LaFolia13 dyktr_06 hikikomori sepa38 Seed57_cash Udon ryota2357
お気に入りにしたユーザー ProblemId : 9767 / 自分の提出
問題文最終更新日: 2023-08-12 12:01:48
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
MMA Contest 016 (順位表) の他の問題:

Problem Statement

You are given $N$ pairs of $A$ and $B$. Answer the following problem for each of them.

Find the smallest integer $X$ such that $\sqrt{A}+\sqrt{B} < X$.

Constraints

  • $1 \leq N \leq 2.5 \times 10^5$
  • $1 \leq A, B \leq 10^9$
  • All inputs are integers.

Input

$N$
$A_1\ B_1$
$ \vdots $
$A_N\ B_N$

Output

On each line, print the smallest integer $X$ satisfying the condition in the problem statement, and print a newline at the end.

Sample

Sample 1
Input
2
1 1
10000 10000
Output
3
201

Since $\sqrt{1}+\sqrt{1} = 2$, the answer is $3$, the smallest integer greater than $2$.
Since $\sqrt{10000}+\sqrt{10000} = 200$, the answer is $201$, the smallest integer greater than $200$.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。