mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-11 20:46:27 +00:00
21 lines
340 B
C++
21 lines
340 B
C++
|
#include <bits/stdc++.h>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
int t, x, y;
|
||
|
|
||
|
int main() {
|
||
|
cin >> t;
|
||
|
while (t--) {
|
||
|
cin >> x >> y;
|
||
|
if (x > y) {
|
||
|
cout << x + y << endl;
|
||
|
} else if (x == y) {
|
||
|
cout << x << endl;
|
||
|
} else {
|
||
|
cout << y - (y % x / 2) << endl;
|
||
|
}
|
||
|
}
|
||
|
return 0;
|
||
|
}
|