题目:
Monitor
描述:
Reca company makes monitors, the most popular of their models is AB999 with the screen size a × b centimeters. Because of some production peculiarities a screen parameters are integer numbers. Recently the screen sides ratio x: y became popular with users. That's why the company wants to reduce monitor AB999 size so that its screen sides ratio becomes x: y, at the same time they want its total area to be maximal of all possible variants. Your task is to find the screen parameters of the reduced size model, or find out that such a reduction can't be performed.
输入:
The first line of the input contains 4 integers — a, b, x and y (1 ≤ a, b, x, y ≤ 2·109).
输出:
If the answer exists, output 2 positive integers — screen parameters of the reduced size model. Output 0 0 otherwise.
样例输入:
800 600 4 3
复制
样例输出:
800 600
复制
样例输入:
1920 1200 16 9
复制
样例输出:
1920 1080
复制
样例输入:
1 1 1 2
复制
样例输出:
0 0
翻译:
描述:
Race公司制作了一个显示器,他们最流行的型号是屏幕尺寸为a*b厘米的AB999,由于这些产品的屏幕特性,屏幕参数是整数,最近尺寸为比率x: y的屏幕很受使用者的欢迎,这是为什么这个公司想缩小AB999尺寸的显示器,使得屏幕的边长比率变成x: y,同时他们想使总面积达到最大,你的任务是找出缩小的尺寸模型的屏幕参数,或找出不能进行这样的缩小。
输入:
第一行包含四个整数--— a, b, x 和y (1 ≤ a, b, x, y ≤ 2·109).
输出:
如果答案存在,输出两个正整数,缩小的尺寸模型的屏幕参数,否则输出0 0.