308951: CF1603B. Moderate Modular Mode
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Moderate Modular Mode
题意翻译
给定两个**偶数** $x,y$ 求一个 $n \in [1,2\times10^{18}]$ 满足 $n \bmod x = y \bmod n$ 一个测试点有多组数据,数据保证有解题目描述
YouKn0wWho has two even integers $ x $ and $ y $ . Help him to find an integer $ n $ such that $ 1 \le n \le 2 \cdot 10^{18} $ and $ n \bmod x = y \bmod n $ . Here, $ a \bmod b $ 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 \le t \le 10^5 $ ) — the number of test cases. The first and only line of each test case contains two integers $ x $ and $ y $ ( $ 2 \le x, y \le 10^9 $ , both are even).
输出格式
For each test case, print a single integer $ n $ ( $ 1 \le n \le 2 \cdot 10^{18} $ ) 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