No.1656 Recuperation
問題文最終更新日: 2022-04-26 00:02:47
English (AI translation)
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もしくは右上の雲マークをクリックしてアカウントを作成してください。
harurun