题目链接:https://codeforces.com/contest/16/problem/C
#include <iostream>
using namespace std
;
int gcd(int a
,int b
) { return b
?gcd(b
,a
%b
):a
; }
int main()
{
int a
,b
,x
,y
;
scanf("%d%d%d%d",&a
,&b
,&x
,&y
);
int d
=gcd(x
,y
);
x
/=d
; y
/=d
;
if(x
>a
|| y
>b
) puts("0 0");
else
{
int k
=min(a
/x
,b
/y
);
printf("%d %d\n",x
*k
,y
*k
);
}
return 0;
}
转载请注明原文地址:https://blackberry.8miu.com/read-8953.html