No.751 Frac #2
問題文最終更新日: 2018-12-07 22:03:41
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 203
(順位表)
の他の問題:
Problem Statement
You are given a fraction in the following format.
Find a fraction equal to the given fraction that is either an irreducible fraction or a fraction whose denominator is $1$.
Input
$\begin {array} { l } n_1 \\ A_1 \ A_2 \ \cdots A_{ n_1 } \\ n_2 \\ B_1 \ B_2 \ \cdots B_{ n_2 } \end {array}$
Integers satisfying the following constraints are given.
Output
Output the answer fraction in the format "numerator denominator".
If the fraction is negative, attach the minus sign to the numerator.
Sample
Sample 1
Input
3
1 8 3
2
6 10
Output
5 72
Sample 2
Input
2
-1 1
3
-1 1 -1
Output
-1 1
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
37zigen