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.



不要被他给的图迷惑,这就是个水题。

include<iostream>
using namespace std;
int main()
{
long long int n,m,k,i;
cin>>n>>m>>k;
if((n*m)%(2*k)!=0)
{
cout<<"NO";
return 0;
}
for(i=1;i<=m;i++)
{
if((n*i)==(2*n*m)/k)
{
cout<<"YES"<<endl;
cout<<0<<' '<<0<<endl;
cout<<0<<' '<<n<<endl;
cout<<n<<' '<<i<<endl;
return 0;
}
}
for(i=1;i<=n;i++)
{
if((m*i)==(2*n*m)/k)
{
cout<<"YES"<<endl;
cout<<0<<' '<<0<<endl;
cout<<0<<' '<<m<<endl;
cout<<0<<' '<<i<<endl;
return 0;
}
}
}

最新文章

  1. nginx beginners_guide
  2. Maven插件之maven-archetype-plugin
  3. 用xutils3.0进行下载
  4. 【工作代码】复杂 JSON 值替换处理
  5. J2EE开发规范
  6. CentOS 6使用mutt+msmtp发送邮件
  7. 【BZOJ】【1001】 【BJOI2006】狼抓兔子
  8. Spring.Net AOP实例
  9. 获取程序中无需释放的ViewController
  10. poj 1091 跳骚
  11. Redis系列四(keepalived+lvs搭建负载均衡)
  12. 在本地搭建play-with-docker
  13. C/C++ typedef
  14. Python:fake-useragent 伪装请求头
  15. react_app 项目开发 (3)_单页面设计_react-router4
  16. NumPy 学习笔记(一)
  17. CM005-逆向分析过程(上篇)
  18. AngularJS指令详解
  19. Docker学习笔记-Windows系统支持(一)
  20. 【BZOJ 2595】2595: [Wc2008]游览计划 (状压DP+spfa,斯坦纳树?)

热门文章

  1. python 爬虫之 urllib库
  2. 28.5 Integer-- int的包装类
  3. Python爬虫系列(四):Beautiful Soup解析HTML之把HTML转成Python对象
  4. 学习Saleforce | 业内第一份Salesforce学习者数据报告
  5. 计算机视觉中的对象检测,Python用几段代码就能实现
  6. Python的炫技操作:条件语句的七种写法
  7. sqli-labs通关教程----31~40关
  8. 图2-4TCP状态转换图
  9. 跨行程序员Java进阶--基础语法
  10. C#开发BIMFACE系列39 网页集成开发3:审图系统中三维模型比对