Good Bye 2023 1916B - Two Divisors Solution
Problem Link : https://codeforces.com/contest/1916/problem/B
Solution in C++:
- /// Author : AH_Tonmoy
- #include <bits/stdc++.h>
- using namespace std;
- int32_t main() {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- int t;
- cin >> t;
- while (t--) {
- long long a , b ;
- cin >> a >> b ;
- long long lcm = ( a * b )/__gcd(a,b) ;
- if ( lcm <= b ){
- cout << lcm * (b/a) << '\n';
- }
- else
- cout << lcm << '\n';
- }
- return 0 ;
- }
No comments