Problem D:Last Will
题号:NC224027
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 1024 M,其他语言2048 M
64bit IO Format: %lld

题目描述

David is a farmer and has a large farm. The shape of the farm is a square. A square is a quadrilateral that has four equal sides and four equal angles. The length of any side of David’s farm is one kilo meter, so the area of his farm is slightly greater than the total area of 140 standard football fields.
David is old and very ill. He feels that his days are numbered. Worrying that his spouse Dora and their three children, Alice, Bob, and Cliff, will have a dispute over the ownership of the farm after he passes away, he plans to divide the farm into four parts, and then to allocate each part to one of his family members. He decides to write his last will as follows.
1.Assume that the shape of the farm is a square ABCD where A = (0, 0), B = (1, 0),C = (1, 1), D = (0, 1).
2.Let E = (0.5, 0), F = (1, 0.5), G = (0.5, 1), H = (0, 0.5) be the midpoints of , ,, , respectively.
3.Let area(P RQS) to denote the area of the quadrilateral P QRS.
4.Please find a point X strictly inside the square ABCD such that
     area(AEXH) : area(BF XE) : area(CGXF) = p : q : r
 Note that X cannot be on the boundary of the square ABCD.
5.Allocate the land in AEXH, BFXE, CGXF, DHXG to Alice, Bob, Cliff and Dora, respectively.

David is still adjusting the numbers. p, q, r, and his lawyer, Reed, has to read David’s last will carefully. Reed finds that it is impossible to find such point X if David gives an improper set of the numbers such as p = 1, q = 2, r = 1. However, there are proper sets of the numbers p, q, r that allow us to find the point X satisfying David’s last will. For instance, let p : q : r = 2 : 3 : 2, the following figure shows a possible position of X.
    
    Figure 2: area(AEXH) : area(BFXE) : area(CGXF) = 2 : 3 : 2
Please write a program to help Reed to determine whether it is possible to find a point X satisfying David’s last will for a given set of numbers p, q, r. If possible, please output one possible position of X to Reed.

输入描述:

The input contains one line only. The line contains three space-separated positive integers p, q, r. 

输出描述:

If there does not exist a point X satisfying David’s last will, then output -1.
Otherwise, output two irreducible fractions x and y such that (x, y) can be the point X satisfying David’s last will.
You must output an irreducible fraction t= as n/d with a positive denominator and use exactly one space to separate x and y.
Note: the numerator and the denominator of any irreducible fraction are integers and do not have common divisors other than 1 and −1.
示例1

输入

复制
1 1 1

输出

复制
1/2 1/2
示例2

输入

复制
1 2 1

输出

复制
-1
示例3

输入

复制
2 3 2

输出

复制
1/4 3/4

备注:

• p, q, r ∈ {1, 2, . . . , 106}