-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11889.cpp
More file actions
32 lines (31 loc) · 774 Bytes
/
11889.cpp
File metadata and controls
32 lines (31 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
* ____
* ____ ___ ____ ________ __/ __/
* / __ `__ \/ __ `/ ___/ / / / /_
* / / / / / / /_/ / / / /_/ / __/
* /_/ /_/ /_/\__,_/_/ \__,_/_/
*
* @link : https://the-redback.com
*/
#include <bits/stdc++.h>
using namespace std;
#define inf HUGE_VAL
#define mem(a, b) memset(a, b, sizeof(a))
#define MM 1001
int main() {
int n, k, i, m, c;
int tc, t = 1;
scanf("%d", &tc);
while (tc--) {
scanf("%d %d", &n, &c);
if (c % n != 0)
printf("NO SOLUTION\n");
else {
k = c / n;
for (i = k; i <= c; i += k)
if ((i / __gcd(i, n)) * n == c) break;
printf("%d\n", i);
}
}
return 0;
}