#include<iostream>
#include<cstdio>
using namespace std;
int gcd(int a,int b)
{
if(b==0)
return a;
else
return gcd(b,a%b);
}
int main()
{
int x1,x2,y1,y2,x,y;
int t;
char c;
cin>>x1>>c>>y1;
cin>>x2>>c>>y2;
x=x1*x2;
y=y1*y2;
t=gcd(x,y);
x=x/t;
y=y/t;
cout<<y<<" "<<x<<endl;//注意先输出列再输出行
return 0;
}
洛谷p1482 Cantor表(升级版) 入门 数论,gcd
最新推荐文章于 2024-05-08 11:40:48 发布