CodeForces - 1058D D. Vasya and Triangle
D. Vasya and Triangle
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
Vasya has got three integers n, m and k. He’d like to find three integer points (x1,y1), (x2,y2), (x3,y3), such that 0≤x1,x2,x3≤n, 0≤y1,y2,y3≤m and the area of the triangle formed by these points is equal to nmk.
Help Vasya! Find such points (if it’s possible). If there are multiple solutions, print any of them.
Input
The single line contains three integers n, m, k (1≤n,m≤109, 2≤k≤109).
Output
If there are no such points, print “NO”.
Otherwise print “YES” in the first line. The next three lines should contain integers xi,yi — coordinates of the points, one point per line. If there are multiple solutions, print any of them.
You can print each letter in any case (upper or lower).
Examples
inputCopy
4 3 3
outputCopy
YES
1 0
2 3
4 1
inputCopy
4 4 7
outputCopy
NO
Note
In the first example area of the triangle should be equal to nmk=4. The triangle mentioned in the output is pictured below:
In the second example there is no triangle with area n*m/k=16/7.
不要被他給的圖迷惑,這就是個水題。
總結
以上是生活随笔為你收集整理的CodeForces - 1058D D. Vasya and Triangle的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 金税盘开票步骤流程 金税盘怎么开发票
- 下一篇: hdu2544最短路