問題一覧 > 通常問題

No.1656 Recuperation

レベル : / AI推定難易度 : 101 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 345
作問者 : 👑 箱星 / テスター : harurun ygussany
お気に入りにしたユーザー ProblemId : 6748 / 自分の提出
問題文最終更新日: 2022-04-26 00:02:47
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
yukicoder contest 311 (順位表) の他の問題:

Problem Statement

Working for $1$ day increases stress by $A$, and resting for $1$ day decreases stress by $1$.

Koboshi's initial stress is $0$. Koboshi worked from day $1$ through day $B$, and decided to rest from day $B+1$ onward.

On which day does the stress become $0$ again?

Answer for $T$ test cases.

Constraints

  • $1\le T\le 100$
  • $1\le A,B\le 1000$
  • All inputs are integers.

Input

$T$
$\text{case}_1$
$\text{case}_2$
$\vdots$
$\text{case}_T$

Each test case is given in the following format.

$A$ $B$

Output

Output $T$ lines. On the $i$-th line, output the answer for the $i$-th test case.

Sample

Sample 1
Input
2
2 3
3 1
Output
9
4

(Test case $1$) The stress changes as $2,4,6,5,4,3,2,1,0$.

(Test case $2$) The stress changes as $3,2,1,0$.

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