一直错,没想到就是忘换行了
import java.util.Scanner;
public class AOJ_0005 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
while(sc.hasNext()){
long a=sc.nextLong();
long b=sc.nextLong();
long p=gcd(a,b);
System.out.println(p+" "+a/p*b);
}
}
static long gcd(long a,long b){
if(b==0)return a;
return gcd(b,a%b);
}
}