P10858 [HBCPC2024] Long Live 题解
Cyx20110930 · · 题解
简要题意
输入
Sol
一看,这不可以秒杀吗?
因为
易得
Code
十年 OI 一场空,不开 long long 见祖宗!
#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int gcd(int a,int b)
{
return b>0 ? gcd(b,a%b):a;
}
signed main()
{
int t;
cin>>t;
while(t--)
{
int x,y;
cin>>x>>y;
cout<<"1 "<<(x*y/gcd(x,y))/gcd(x,y)<<endl;
}
}