fork download
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. using namespace std;
  4. int main(){
  5. int test; cin >> test;
  6. while(test--){
  7. ll a, b; cin >> a >> b;
  8. ll x = a * b;
  9. while(b != 0){
  10. ll temp = a % b;
  11. a = b;
  12. b = temp;
  13. }
  14. ll y = x/a;
  15. cout << "UCLN: " << a << "\n";
  16. cout << "BCNN: " << y << "\n";
  17. cout << "\n";
  18. }
  19. }
Success #stdin #stdout 0.01s 5288KB
stdin
2
12 34
1234 5678
stdout
UCLN: 2
BCNN: 204

UCLN: 2
BCNN: 3503326