CF1603B.Moderate Modular Mode
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
YouKn0wWho has two even integers x and y . Help him to find an integer n such that 1≤n≤2⋅1018 and nmodx=ymodn . Here, amodb denotes the remainder of a after division by b . If there are multiple such integers, output any. It can be shown that such an integer always exists under the given constraints.
输入格式
The first line contains a single integer t ( 1≤t≤105 ) — the number of test cases.
The first and only line of each test case contains two integers x and y ( 2≤x,y≤109 , both are even).
输出格式
For each test case, print a single integer n ( 1≤n≤2⋅1018 ) that satisfies the condition mentioned in the statement. If there are multiple such integers, output any. It can be shown that such an integer always exists under the given constraints.
输入输出样例
输入#1
4 4 8 4 2 420 420 69420 42068
输出#1
4 10 420 9969128
说明/提示
In the first test case, 4mod4=8mod4=0 .
In the second test case, 10mod4=2mod10=2 .
In the third test case, 420mod420=420mod420=0 .