package cn.itcast.girl.TheBlueCup_02;
import java.util.Scanner;
public class Cantor {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scanner = new Scanner(System.in);
String[] array_1 = scanner.nextLine().split("/");
String[] array_2 = scanner.nextLine().split("/");
int a = Integer.parseInt(array_1[0])*Integer.parseInt(array_2[0]);
// System.out.println(a);
int b = Integer.parseInt(array_1[1])*Integer.parseInt(array_2[1]);
// System.out.println(b);
int gcd = gcd(a,b);
System.out.println(b/gcd+" "+a/gcd);
scanner.close();
}
public static int gcd(int a, int b) {
if (b == 0) {
return a;
}
return gcd(b, a % b);
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)